Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/app/pages/door-check/door-check.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,18 @@ export class DoorCheckPage implements OnInit, OnDestroy {
this.syncAllPending();
this.pycon.fetchCheckInProducts().then((data) => {
data.subscribe(redeemable => {
this.redeemable_products = redeemable?.redeemable_products;
this.redeemable_categories = redeemable?.redeemable_categories;
// /check_in/redeemable/ returns the union of every redeemable
// category (sessions + swag) and CategorySerializer omits
// render_type, so we have to discriminate by name. Door check
// is for sessions/events only — drop the merch categories and
// any products hanging off them. Long-term fix: expose
// render_type (==10 for presentations) on the API.
const categories = (redeemable?.redeemable_categories ?? [])
.filter(c => !/shirt|swag/i.test(c?.name ?? ''));
const keepIds = new Set(categories.map(c => c.id));
this.redeemable_categories = categories;
this.redeemable_products = (redeemable?.redeemable_products ?? [])
.filter(p => keepIds.has(p.category));
})
})
}
Expand Down
14 changes: 12 additions & 2 deletions src/app/pages/t-shirt-redemption/t-shirt-redemption.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,18 @@ export class TShirtRedemptionPage implements OnInit, OnDestroy {
this.ios = this.config.get('mode') === `ios`;
this.pycon.fetchCheckInProducts().then((data) => {
data.subscribe(redeemable => {
this.redeemable_products = redeemable?.redeemable_products;
this.redeemable_categories = redeemable?.redeemable_categories;
// /check_in/redeemable/ returns the union of every redeemable
// category (sessions + swag) and CategorySerializer omits
// render_type, so we have to discriminate by name. Swag pickup
// only redeems merch — keep T-Shirt categories (and any
// future "swag-*" naming) and drop the rest. Long-term fix:
// expose render_type on the API.
const categories = (redeemable?.redeemable_categories ?? [])
.filter(c => /shirt|swag/i.test(c?.name ?? ''));
const keepIds = new Set(categories.map(c => c.id));
this.redeemable_categories = categories;
this.redeemable_products = (redeemable?.redeemable_products ?? [])
.filter(p => keepIds.has(p.category));
})
})
}
Expand Down
Loading