Skip to content

Commit e0db775

Browse files
authored
Merge pull request #128 from hackclub/clubsupport
Show shipped + approved club hours
2 parents 5f41a02 + 58ca5d9 commit e0db775

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/routes/dashboard/clubs/+page.server.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { db } from '$lib/server/db/index.js';
2-
import { club, clubMembership, user, devlog, ship } from '$lib/server/db/schema.js';
2+
import { club, clubMembership, user, devlog, ship, project } from '$lib/server/db/schema.js';
33
import { error, fail } from '@sveltejs/kit';
44
import { eq, and, sql, inArray } from 'drizzle-orm';
55
import { getLeaderClub } from '$lib/server/clubs-api.js';
@@ -61,9 +61,10 @@ export async function load({ locals }) {
6161
// Calculate club hours from devlogs on shipped club projects
6262
// Get project IDs that were shipped as this club
6363
const clubShips = await db
64-
.selectDistinct({ projectId: ship.projectId })
65-
.from(ship)
66-
.where(eq(ship.clubId, userMembership.clubId));
64+
.selectDistinct({ projectId: project.id })
65+
.from(project)
66+
.innerJoin(ship, eq(ship.projectId, project.id))
67+
.where(and(eq(project.status, 'finalized'), eq(ship.clubId, userMembership.clubId)));
6768

6869
let totalMinutes = 0;
6970
if (clubShips.length > 0) {

0 commit comments

Comments
 (0)