chore(format): Prettier auf time.ts anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor der byProject-Query. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c98d27e70c
commit
2eef94afce
1 file changed
+13
-5
@@ -44,7 +44,10 @@ function unionSeconds(intervals: Array<readonly [number, number]>): number {
|
||||
}
|
||||
|
||||
async function stopOneEntry(db: Db, entry: TimeEntry, now: Date): Promise<TimeEntry | null> {
|
||||
const durationSeconds = Math.max(0, Math.round((now.getTime() - entry.startedAt.getTime()) / 1000));
|
||||
const durationSeconds = Math.max(
|
||||
0,
|
||||
Math.round((now.getTime() - entry.startedAt.getTime()) / 1000),
|
||||
);
|
||||
const [stopped] = await db
|
||||
.update(timeEntry)
|
||||
.set({ endedAt: now, durationSeconds, updatedAt: now })
|
||||
@@ -199,7 +202,11 @@ export const timeRouter = router({
|
||||
}
|
||||
const startedAt = input.startedAt ? new Date(input.startedAt) : existing.startedAt;
|
||||
const endedAt =
|
||||
input.endedAt === undefined ? existing.endedAt : input.endedAt === null ? null : new Date(input.endedAt);
|
||||
input.endedAt === undefined
|
||||
? existing.endedAt
|
||||
: input.endedAt === null
|
||||
? null
|
||||
: new Date(input.endedAt);
|
||||
const durationSeconds = endedAt
|
||||
? Math.max(0, Math.round((endedAt.getTime() - startedAt.getTime()) / 1000))
|
||||
: null;
|
||||
@@ -211,8 +218,7 @@ export const timeRouter = router({
|
||||
durationSeconds,
|
||||
todoId: input.todoId === undefined ? existing.todoId : input.todoId,
|
||||
category: input.category ?? existing.category,
|
||||
description:
|
||||
input.description === undefined ? existing.description : input.description,
|
||||
description: input.description === undefined ? existing.description : input.description,
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
.where(eq(timeEntry.id, input.id))
|
||||
@@ -368,7 +374,9 @@ export const timeRouter = router({
|
||||
.where(cond)
|
||||
.orderBy(asc(timeEntry.startedAt));
|
||||
|
||||
const todoIds = Array.from(new Set(rows.map((r) => r.todoId).filter((x): x is string => !!x)));
|
||||
const todoIds = Array.from(
|
||||
new Set(rows.map((r) => r.todoId).filter((x): x is string => !!x)),
|
||||
);
|
||||
const titles = new Map<string, string>();
|
||||
if (todoIds.length > 0) {
|
||||
const tr = await ctx.db
|
||||
|
||||
Reference in new issue
Block a user