Skip to content

Commit

Permalink
Incorporate hidden_from_ui and is_low_income
Browse files Browse the repository at this point in the history
  • Loading branch information
brundonsmith committed Apr 19, 2024
1 parent addb1a7 commit b3d01e3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions back-end/routes/v1/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default function register(router: Router) {
application_status: applicationStatus,
// allowed_to_purchase: allowedToPurchase,
is_team_member: account.is_team_member,
is_low_income: account.is_low_income,
attendees,
purchases,
// inviteCodes
Expand Down
3 changes: 2 additions & 1 deletion back-end/types/db-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type Tables = {
application_id: Tables['application']['application_id'] | null,
email_address: string,
is_authorized_to_buy_tickets: boolean | null,
is_low_income: boolean,
is_seed_account: boolean,
is_team_member: boolean,
notes: string,
Expand Down Expand Up @@ -178,7 +179,7 @@ export const TABLE_ROWS = {
} as const

export const TABLE_COLUMNS = {
account: ["account_id","application_id","email_address","is_authorized_to_buy_tickets","is_seed_account","is_team_member","notes","password_hash","password_salt"],
account: ["account_id","application_id","email_address","is_authorized_to_buy_tickets","is_low_income","is_seed_account","is_team_member","notes","password_hash","password_salt"],
age_range: ["age_range","description","end","start"],
application: ["anything_else","application_id","attractive_virtues","experiences_hoping_to_share","group_activity","hoping_to_get_out_of_the_festival","how_found_out","identify_as","interested_in_volunteering","is_accepted","last_conversation","looking_forward_to_conversations","name","previous_events","strongest_virtues","submitted_on","twitter_handle"],
attendee: ["age","age_range","associated_account_id","attendee_id","diet","discord_handle","festival_id","has_allergy_eggs","has_allergy_fish","has_allergy_milk","has_allergy_peanuts","has_allergy_shellfish","has_allergy_soy","has_allergy_tree_nuts","has_allergy_wheat","interested_in_pre_call","interested_in_volunteering_as","is_primary_for_account","medical_training","name","notes","planning_to_camp","twitter_handle"],
Expand Down
2 changes: 1 addition & 1 deletion back-end/types/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type VibeJWTPayload = {
}

export type FullAccountInfo =
& Pick<Tables['account'], 'account_id' | 'email_address' | 'is_team_member'>
& Pick<Tables['account'], 'account_id' | 'email_address' | 'is_team_member' | 'is_low_income'>
& {
application_status: 'unsubmitted' | 'pending' | 'accepted' | 'rejected',
// allowed_to_purchase: boolean,
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/components/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default observer(() => {
Events
</h1>

{someValue(Store.purchasedTickets, t => t != null && t.length > 0) &&
{someValue(Store.purchasedTicketsByFestival, t => t != null && t.length > 0) &&
<Button onClick={state.createNewEvent} isCompact style={{ width: 'auto' }}>
Create event

Expand Down
7 changes: 4 additions & 3 deletions front-end/src/components/tickets/SelectionView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ export default observer((props: Props) => {
return Store.purchaseTypes.state.result
?.filter(t =>
t.festival_id === props.festival?.festival_id &&
purchaseTypeAvailableNow(t))
purchaseTypeAvailableNow(t) &&
!t.hidden_from_ui)
.sort((a, b) => b.price_in_cents - a.price_in_cents) ?? []
}

get attendancePurchases() {
return this.festivalPurchases.filter(t => t.is_attendance_ticket)
return this.festivalPurchases.filter(t => t.is_attendance_ticket && (!t.low_income_only || Store.accountInfo.state.result?.is_low_income))
}

get otherPurchases() {
Expand Down Expand Up @@ -161,7 +162,7 @@ export default observer((props: Props) => {

</>}

{Store.purchasedTickets[festival.festival_id]?.length === 0 && festival.festival_name === 'Vibeclipse 2024' && // HACK
{Store.purchasedTicketsByFestival[festival.festival_id]?.length === 0 && festival.festival_name === 'Vibeclipse 2024' && // HACK
<>
<Spacer size={32} />
<hr />
Expand Down

0 comments on commit b3d01e3

Please sign in to comment.