fix: MC series uses earliest slot date for registration cutoff
Multi-session master classes are a series — once the first session passes, the group has started and registration closes. Changed all MC date logic from "latest slot" / "any future slot" to "earliest slot": - DashboardSummary: upcoming = earliest slot >= today - McRegistrationsTab: archive = earliest slot < today - AddBookingModal: only show MCs where earliest slot >= today - Public MasterClasses: isUpcoming checks earliest slot
This commit is contained in:
@@ -72,16 +72,18 @@ function calcDuration(slot: MasterClassSlot): string {
|
||||
|
||||
function isUpcoming(item: MasterClassItem): boolean {
|
||||
const now = new Date();
|
||||
return (item.slots ?? []).some((s) => {
|
||||
const slotDate = parseDate(s.date);
|
||||
if (s.startTime) {
|
||||
const [h, m] = s.startTime.split(":").map(Number);
|
||||
slotDate.setHours(h, m, 0, 0);
|
||||
} else {
|
||||
slotDate.setHours(23, 59, 59, 999);
|
||||
}
|
||||
return slotDate > now;
|
||||
});
|
||||
const slots = item.slots ?? [];
|
||||
if (slots.length === 0) return false;
|
||||
// Series MC: check earliest slot — if first session passed, group already started
|
||||
const earliestSlot = slots.reduce((min, s) => s.date < min.date ? s : min, slots[0]);
|
||||
const d = parseDate(earliestSlot.date);
|
||||
if (earliestSlot.startTime) {
|
||||
const [h, m] = earliestSlot.startTime.split(":").map(Number);
|
||||
d.setHours(h, m, 0, 0);
|
||||
} else {
|
||||
d.setHours(23, 59, 59, 999);
|
||||
}
|
||||
return d > now;
|
||||
}
|
||||
|
||||
function MasterClassCard({
|
||||
|
||||
Reference in New Issue
Block a user