Icon refactor
This commit is contained in:
@@ -69,7 +69,6 @@ export const GET: APIRoute = async ({ params, locals }) => {
|
||||
invoice: {
|
||||
...invoice,
|
||||
notes: invoice.notes || null,
|
||||
// Ensure null safety for optional fields that might be undefined in some runtimes depending on driver
|
||||
discountValue: invoice.discountValue ?? null,
|
||||
discountType: invoice.discountType ?? null,
|
||||
discountAmount: invoice.discountAmount ?? null,
|
||||
|
||||
@@ -44,7 +44,6 @@ export const POST: APIRoute = async ({ request, params, locals, redirect }) => {
|
||||
|
||||
const startDate = new Date(startDateStr);
|
||||
const endDate = new Date(endDateStr);
|
||||
// Set end date to end of day
|
||||
endDate.setHours(23, 59, 59, 999);
|
||||
|
||||
const invoice = await db
|
||||
@@ -174,7 +173,6 @@ export const POST: APIRoute = async ({ request, params, locals, redirect }) => {
|
||||
|
||||
for (const day of days.values()) {
|
||||
const hours = day.totalDuration / (1000 * 60 * 60);
|
||||
// Avoid division by zero
|
||||
const unitPrice = hours > 0 ? Math.round(day.totalAmount / hours) : 0;
|
||||
|
||||
newItems.push({
|
||||
@@ -193,7 +191,6 @@ export const POST: APIRoute = async ({ request, params, locals, redirect }) => {
|
||||
const duration = entry.endTime.getTime() - entry.startTime.getTime();
|
||||
const hours = duration / (1000 * 60 * 60);
|
||||
|
||||
// Determine rate: max of tags, or 0
|
||||
const rate = rates.length > 0 ? Math.max(...rates) : 0;
|
||||
const amount = Math.round(hours * rate);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user