Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
Add exporting swag tiers
Browse files Browse the repository at this point in the history
  • Loading branch information
akrantz01 committed Jul 3, 2023
1 parent e641599 commit 056ed94
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/database/tables/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# The valid exports for each table
VALID_EXPORTS = {
"applications": {"all", "mlh-registered", "resume-book"},
"attendance": {"check-ins", "events", "event-feedback"},
"attendance": {"check-ins", "events", "event-feedback", "swag-tiers"},
}


Expand Down
7 changes: 6 additions & 1 deletion frontend/src/organizers/pages/exports/New.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ const KINDS: Record<string, Record<string, string>> = {
'mlh-registered': 'MLH Registrations',
'resume-book': 'Resume Book',
},
[Table.Attendance]: { 'check-ins': 'Check-ins', events: 'Events', 'event-feedback': 'Event Feedback' },
[Table.Attendance]: {
'check-ins': 'Check-ins',
events: 'Events',
'event-feedback': 'Event Feedback',
'swag-tiers': 'Swag Tiers',
},
};

interface Values {
Expand Down
3 changes: 2 additions & 1 deletion tasks/handlers/integration/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from common.settings import SETTINGS

from .applications import All, MLHRegistered, ResumeBook
from .attendance import CheckIns, EventFeedback, Events
from .attendance import CheckIns, EventFeedback, Events, SwagTiers
from .base import Exporter

manual = True
Expand All @@ -29,6 +29,7 @@
"check-ins": CheckIns(),
"events": Events(),
"event-feedback": EventFeedback(),
"swag-tiers": SwagTiers(),
},
}

Expand Down
16 changes: 16 additions & 0 deletions tasks/handlers/integration/export/attendance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Feedback,
Participant,
School,
SwagTier,
)

from .base import Exporter
Expand Down Expand Up @@ -73,3 +74,18 @@ class EventFeedback(Exporter):
.join_from(Event, Feedback)
.group_by(Event.name)
)


class SwagTiers(Exporter):
header = ["ID", "First Name", "Last Name", "Email", "Tier"]
statement = (
select(
Participant.id,
Participant.first_name,
Participant.last_name,
Participant.email,
SwagTier.name,
)
.join_from(Participant, SwagTier)
.order_by(Participant.swag_tier_id)
)

0 comments on commit 056ed94

Please sign in to comment.