feat: detect passholder preview days and filter plain buyouts
All checks were successful
Build and Deploy / Build & Push (push) Successful in 3m9s
All checks were successful
Build and Deploy / Build & Push (push) Successful in 3m9s
- Buyout days are now treated as closed unless they carry a Passholder Preview event, in which case they surface as a distinct purple cell in the UI showing "Passholder" + hours - DB gains a special_type column (auto-migrated on next startup) - scrape.ts threads specialType through to upsertDay - debug.ts now shows events, isBuyout, isPassholderPreview, and specialType in the parsed result section Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -94,28 +94,37 @@ async function main() {
|
||||
|
||||
// ── Parsed result ──────────────────────────────────────────────────────────
|
||||
const operating =
|
||||
dayData.operatings?.find((o) => o.operatingTypeName === "Park") ??
|
||||
dayData.operatings?.find((o: { operatingTypeName: string }) => o.operatingTypeName === "Park") ??
|
||||
dayData.operatings?.[0];
|
||||
const item = operating?.items?.[0];
|
||||
const hoursLabel =
|
||||
item?.timeFrom && item?.timeTo
|
||||
? `${fmt24(item.timeFrom)} – ${fmt24(item.timeTo)}`
|
||||
: undefined;
|
||||
const isOpen = !dayData.isParkClosed && hoursLabel !== undefined;
|
||||
const isBuyout = item?.isBuyout ?? false;
|
||||
const isPassholderPreview = dayData.events?.some((e: { extEventName: string }) =>
|
||||
e.extEventName.toLowerCase().includes("passholder preview")
|
||||
) ?? false;
|
||||
const isOpen = !dayData.isParkClosed && hoursLabel !== undefined && (!isBuyout || isPassholderPreview);
|
||||
const specialType = isPassholderPreview ? "passholder_preview" : null;
|
||||
|
||||
out("");
|
||||
out("── Parsed result ────────────────────────────────────────────");
|
||||
out(` isParkClosed : ${dayData.isParkClosed}`);
|
||||
out(` operatings : ${dayData.operatings?.length ?? 0} entr${dayData.operatings?.length === 1 ? "y" : "ies"}`);
|
||||
out(` isParkClosed : ${dayData.isParkClosed}`);
|
||||
out(` events : ${dayData.events?.length ?? 0} (${dayData.events?.map((e: { extEventName: string }) => e.extEventName).join(", ") || "none"})`);
|
||||
out(` operatings : ${dayData.operatings?.length ?? 0} entr${dayData.operatings?.length === 1 ? "y" : "ies"}`);
|
||||
if (operating) {
|
||||
out(` selected : "${operating.operatingTypeName}" (${operating.items?.length ?? 0} item(s))`);
|
||||
out(` selected : "${operating.operatingTypeName}" (${operating.items?.length ?? 0} item(s))`);
|
||||
if (item) {
|
||||
out(` timeFrom : ${item.timeFrom} → ${fmt24(item.timeFrom)}`);
|
||||
out(` timeTo : ${item.timeTo} → ${fmt24(item.timeTo)}`);
|
||||
out(` timeFrom : ${item.timeFrom} → ${fmt24(item.timeFrom)}`);
|
||||
out(` timeTo : ${item.timeTo} → ${fmt24(item.timeTo)}`);
|
||||
out(` isBuyout : ${isBuyout}`);
|
||||
}
|
||||
}
|
||||
out(` hoursLabel : ${hoursLabel ?? "(none)"}`);
|
||||
out(` isOpen : ${isOpen}`);
|
||||
out(` isPassholderPreview : ${isPassholderPreview}`);
|
||||
out(` hoursLabel : ${hoursLabel ?? "(none)"}`);
|
||||
out(` isOpen : ${isOpen}`);
|
||||
out(` specialType : ${specialType ?? "(none)"}`)
|
||||
|
||||
// ── Write to file ──────────────────────────────────────────────────────────
|
||||
const debugDir = path.join(process.cwd(), "debug");
|
||||
|
||||
Reference in New Issue
Block a user