From c925ae8811782b55fd206258b89f0f7600fced19 Mon Sep 17 00:00:00 2001 From: Ryan Pandya Date: Tue, 26 Nov 2024 14:04:13 -0800 Subject: [PATCH] Minor bugfix to hours.update --- apps/cli/src/commands/days.ts | 8 +++++--- packages/trpc/routers/days.ts | 1 + packages/trpc/routers/hours.ts | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/cli/src/commands/days.ts b/apps/cli/src/commands/days.ts index 21eeeca..51b5a94 100644 --- a/apps/cli/src/commands/days.ts +++ b/apps/cli/src/commands/days.ts @@ -42,10 +42,12 @@ export const daysCmd = new Command() const moodStr = moodToStars(day.mood); const dateStr = format(day.date, "EEEE, MMMM do"); - const data: string[][] = [[dateStr, '', moodStr], [day.comment ?? "No comment", '', '']]; + const data: string[][] = [[dateStr, '', moodStr], [day.comment ?? "No comment", '', ''], + ["Time", "Category", "Comment"] + ]; day.hours.forEach((h) => { - data.push([getHourFromTime(h.time), h.categoryCode ?? "--", h.comment ?? ""]); + data.push([getHourFromTime(h.time), h.categoryName ?? "--", h.comment ?? ""]); }) console.log(table(data, { @@ -56,7 +58,7 @@ export const daysCmd = new Command() return lineIndex === 0 || lineIndex === columnCount || (lineIndex === 0 && columnCount === 2); }, drawHorizontalLine: (lineIndex, rowCount) => { - return (lineIndex < 2 || lineIndex === 2 || lineIndex === rowCount); + return (lineIndex < 1 || lineIndex === 2 || lineIndex === 3 || lineIndex === rowCount); }, })); } diff --git a/packages/trpc/routers/days.ts b/packages/trpc/routers/days.ts index 89ffe38..4c10a5a 100644 --- a/packages/trpc/routers/days.ts +++ b/packages/trpc/routers/days.ts @@ -94,6 +94,7 @@ export const daysAppRouter = router({ time: hours.time, categoryId: hours.categoryId, categoryCode: categories.code, + categoryName: categories.name, comment: hours.comment, }) .from(hours) diff --git a/packages/trpc/routers/hours.ts b/packages/trpc/routers/hours.ts index 6656c04..eeb4463 100644 --- a/packages/trpc/routers/hours.ts +++ b/packages/trpc/routers/hours.ts @@ -50,7 +50,7 @@ export const hoursAppRouter = router({ dateQuery: z.string(), time: z.number(), code: z.string().optional(), - comment: z.string().nullable(), + comment: z.string().nullable().optional(), }), ) // .output(zHourSchema)