fix: suppress park-page weather-delay flag during wind-down too
Same root cause as 52f7efd — the /rides endpoint also used
isWithinOperatingWindow, which includes the post-close buffer. Switch
to getOperatingStatus and gate the badge on status === "open" so the
park page matches the calendar.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import { Hono } from "hono";
|
|||||||
import { PARK_MAP } from "../../../lib/parks";
|
import { PARK_MAP } from "../../../lib/parks";
|
||||||
import { QUEUE_TIMES_IDS } from "../../../lib/queue-times-map";
|
import { QUEUE_TIMES_IDS } from "../../../lib/queue-times-map";
|
||||||
import { getCoasterSet } from "../../../lib/coaster-data";
|
import { getCoasterSet } from "../../../lib/coaster-data";
|
||||||
import { getTodayLocal, isWithinOperatingWindow } from "../../../lib/env";
|
import { getTodayLocal, getOperatingStatus } from "../../../lib/env";
|
||||||
import { fetchLiveRides } from "../../../lib/scrapers/queuetimes";
|
import { fetchLiveRides } from "../../../lib/scrapers/queuetimes";
|
||||||
import { scrapeRidesForDay } from "../../../lib/scrapers/sixflags";
|
import { scrapeRidesForDay } from "../../../lib/scrapers/sixflags";
|
||||||
import { fetchFastLaneWaits, lookupFastLane } from "../../../lib/scrapers/sixflags-waittimes";
|
import { fetchFastLaneWaits, lookupFastLane } from "../../../lib/scrapers/sixflags-waittimes";
|
||||||
@@ -21,9 +21,10 @@ app.get("/:id/rides", async (c) => {
|
|||||||
|
|
||||||
const today = getTodayLocal();
|
const today = getTodayLocal();
|
||||||
const todayData = getDayData(id, today);
|
const todayData = getDayData(id, today);
|
||||||
const withinWindow = todayData?.hoursLabel
|
const operatingStatus = todayData?.hoursLabel
|
||||||
? isWithinOperatingWindow(todayData.hoursLabel, park.timezone)
|
? getOperatingStatus(todayData.hoursLabel, park.timezone)
|
||||||
: false;
|
: "closed";
|
||||||
|
const withinWindow = operatingStatus !== "closed";
|
||||||
|
|
||||||
const queueTimesId = QUEUE_TIMES_IDS[id];
|
const queueTimesId = QUEUE_TIMES_IDS[id];
|
||||||
let liveRides: LiveRidesResult | null = null;
|
let liveRides: LiveRidesResult | null = null;
|
||||||
@@ -90,8 +91,13 @@ app.get("/:id/rides", async (c) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only flag weather delay during scheduled hours — during the post-close
|
||||||
|
// wind-down buffer, all-rides-closed is just normal closing, not weather.
|
||||||
const isWeatherDelay =
|
const isWeatherDelay =
|
||||||
withinWindow && liveRides !== null && liveRides.rides.length > 0 && liveRides.rides.every((r) => !r.isOpen);
|
operatingStatus === "open" &&
|
||||||
|
liveRides !== null &&
|
||||||
|
liveRides.rides.length > 0 &&
|
||||||
|
liveRides.rides.every((r) => !r.isOpen);
|
||||||
|
|
||||||
let scheduleFallback = null;
|
let scheduleFallback = null;
|
||||||
if (!liveRides) {
|
if (!liveRides) {
|
||||||
|
|||||||
Reference in New Issue
Block a user