diff --git a/backend/src/index.ts b/backend/src/index.ts
index b7b9e19..512bf4d 100644
--- a/backend/src/index.ts
+++ b/backend/src/index.ts
@@ -665,7 +665,7 @@ async function getPeriodTicket(config: PeriodConfig, period: ParsedPeriod, ticke
const periodClosureJoin =
config.type === "month"
? "LEFT JOIN month_closures pc ON pc.month = $3::date AND pc.user_id = $2"
- : "LEFT JOIN (SELECT NULL::timestamptz AS closed_at) pc ON true";
+ : "LEFT JOIN (SELECT $3::date AS period_start, NULL::timestamptz AS closed_at) pc ON true";
const ticketResult = await query(
`
SELECT
diff --git a/frontend/src/views/TicketDetailPage.tsx b/frontend/src/views/TicketDetailPage.tsx
index 4a6cb3e..bf104b4 100644
--- a/frontend/src/views/TicketDetailPage.tsx
+++ b/frontend/src/views/TicketDetailPage.tsx
@@ -228,6 +228,7 @@ export function TicketDetailPage({ periodType, period, ticketId, onNavigate }: T
return Array.from(groups.values());
}, [data?.sessions]);
const periodTotalMinutes = sessionGroups.reduce((sum, group) => sum + group.totalMinutes, 0);
+ const periodTeamspaceMinutes = Array.from(dayBillingMap.values()).reduce((sum, minutes) => sum + Number(minutes ?? 0), 0);
async function setBilling(sessionId: string, billingStatus: BillingStatus) {
if (isPeriodClosed && billingStatus !== null) {
@@ -542,9 +543,15 @@ export function TicketDetailPage({ periodType, period, ticketId, onNavigate }: T