Skip to content

Commit 31a9c6a

Browse files
committed
fix: sales daily
1 parent eb5caa3 commit 31a9c6a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

apps/peatix-adapter/src/sales-daily/sales-daily.service.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,25 @@ export class SalesDailyService {
3636
if (ticketName.includes(Constants.PEATIX_WITH_PARTY_TICKET)) {
3737
return { date: appliedDate, role: Constants.PEATIX_WITH_PARTY_ROLE, receipt_id: receiptId }
3838
}
39+
if (ticketName.includes(Constants.PEATIX_HANDSON_TICKET)) {
40+
return { date: appliedDate, options: { handson: true }, receipt_id: receiptId }
41+
}
42+
if (ticketName.includes(Constants.PEATIX_PERSONAL_SPONSOR_TICKET)) {
43+
return { date: appliedDate, options: { personalSponsor: true }, receipt_id: receiptId }
44+
}
3945

4046
// return { role: 'attendee', receipt_id: receiptId }
4147
})
4248
.filter(v => v) // null は除外
4349

4450
const startedDate = new Date(2024, 7 - 1, 29)
45-
let archives = [[], [], []]
51+
let archives = [[], [], [], [], []]
4652
for (let date = startedDate; date <= new Date(); date.setDate(date.getDate() + 1)) {
4753
archives[0].push(`${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`)
48-
archives[1].push(`${receipts.filter(v => v.role === Constants.PEATIX_GENERAL_ROLE).filter(v => v.date.includes(`${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`)).length}`)
49-
archives[2].push(`${receipts.filter(v => v.role === Constants.PEATIX_WITH_PARTY_ROLE).filter(v => v.date.includes(`${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`)).length}`)
54+
archives[1].push(`${receipts.filter(v => v?.role && v?.role === Constants.PEATIX_GENERAL_ROLE).filter(v => v.date === `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`).length}`)
55+
archives[2].push(`${receipts.filter(v => v?.role && v?.role === Constants.PEATIX_WITH_PARTY_ROLE).filter(v => v.date === `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`).length}`)
56+
archives[3].push(`${receipts.filter(v => v?.options && v?.options?.handson === true).filter(v => v.date === `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`).length}`)
57+
archives[4].push(`${receipts.filter(v => v?.options && v?.options?.personalSponsor === true).filter(v => v.date === `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`).length}`)
5058
}
5159
for (const archive of archives) {
5260
this.logger.log(`${archive.join(',')}`)

apps/peatix-adapter/src/types/supabase.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export type FormAdminUser = Database['public']['Tables']['admin_users']['Insert'
99

1010
export type AttendeeReceipt = {
1111
date: string
12-
role: Extract<Role, TicketRole>
12+
role?: Extract<Role, TicketRole>
13+
options?: {
14+
handson?: boolean
15+
personalSponsor?: boolean
16+
}
1317
receipt_id: string
1418
}

0 commit comments

Comments
 (0)