Skip to content

Commit eaec8d1

Browse files
authored
Merge pull request #82 from hackclub/staging
Fix for projects with no prints
2 parents 5ef2ff0 + 64a8d37 commit eaec8d1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/routes/dashboard/admin/ysws-review/[id]/+page.server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export async function load({ locals, params }) {
6565
project.modelFile,
6666
project.submittedToAirtable,
6767
project.createdAt,
68+
project.updatedAt,
6869
project.status,
6970
user.id,
7071
user.name,
@@ -358,14 +359,14 @@ export const actions = {
358359
} satisfies Actions;
359360

360361
async function getLatestPrintFilament(id: number) {
361-
const [{ filament }] = (await db
362+
const [queriedReview] = await db
362363
.select({
363364
filament: legionReview.filamentUsed
364365
})
365366
.from(legionReview)
366367
.where(and(eq(legionReview.projectId, id), eq(legionReview.action, 'print')))
367368
.orderBy(desc(legionReview.timestamp))
368-
.limit(1)) ?? [{ filament: 0 }];
369+
.limit(1);
369370

370-
return filament ?? 0;
371+
return queriedReview?.filament ?? 0;
371372
}

0 commit comments

Comments
 (0)