Minor bugfix to hours.update

This commit is contained in:
Ryan Pandya 2024-11-26 14:04:13 -08:00
parent 4d6840559d
commit c925ae8811
3 changed files with 7 additions and 4 deletions

View File

@ -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);
},
}));
}

View File

@ -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)

View File

@ -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)