Skip to content

Commit

Permalink
Update CSV export for check-in data
Browse files Browse the repository at this point in the history
  • Loading branch information
JaneIRL committed Oct 8, 2023
1 parent 19e45af commit 2cd0360
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/app/admin/applications/ApplicantDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type Row = Omit<Application, 'resume'> & {
email: string
resume: boolean
status: 'accepted' | 'rejected' | 'waitlisted' | 'undecided'
checkedIn: string
}

export interface ApplicantDataTableProps {
Expand Down Expand Up @@ -117,9 +118,7 @@ export default function ApplicantDataTable({
r.phoneNumber,
r.countryOfResidence,
r.levelOfStudy,
r.agreedMlhCoC === 'Yes' ? 'TRUE' : 'FALSE',
r.agreedMlhMarketing === 'Yes' ? 'TRUE' : 'FALSE',
r.agreedMlhSharing === 'Yes' ? 'TRUE' : 'FALSE',
r.checkedIn ?? 'N/A',
]
const row = (r: Row) => fields(r).map(cell).join(',')
const headers = () => [
Expand All @@ -131,9 +130,7 @@ export default function ApplicantDataTable({
'Phone Number',
'Country',
'Current Level of Study',
'Code of Conduct Checkbox',
'MLH Marketing Opt In Checkbox',
'Privacy Policy Checkbox',
'Checked In',
]
const csv = [headers(), ...apps.map(row)].join('\n')
anchor.setAttribute(
Expand Down
6 changes: 5 additions & 1 deletion src/app/admin/applications/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default async function Applications() {
else: 'undecided',
},
},
'application.checkedIn': '$checkedIn',
},
},
{
Expand All @@ -62,7 +63,10 @@ export default async function Applications() {

return (
<ApplicantDataTable
applications={applications}
applications={applications.map((a) => ({
...a,
checkedIn: a.checkedIn?.toString(),
}))}
blockedHackers={blockedHackers}
perms={perms}
/>
Expand Down

0 comments on commit 2cd0360

Please sign in to comment.