Repository navigation
fix(phantasialand): read the calendar from the page's data stream - #716
Open
BeyondVertical wants to merge 1 commit into
Open
BeyondVertical wants to merge 1 commit into
BeyondVertical wants to merge 1 commit into
Conversation
The schedule page no longer carries a data-calendar attribute. The calendar
now sits in the Next.js data stream (self.__next_f.push calls) as a
calendar-block with calendarData and colorLegendLabels. getCalendarJSON()
found no attribute and returned an empty list, so no opening hours came out.
parseCalendar() reads the stream and returns the same {title, days_selected}
events as before, so buildSchedules() is unchanged.
The English page now writes times like "11 a.m. – 08 p.m." with a dash
instead of "until". parseHours() takes both with one 12-hour pattern.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Phantasialand schedule page was rebuilt as a Next.js page and no longer carries a
data-calendarattribute.getCalendarJSON()finds no attribute and returns[], sobuildSchedules()gets no events and the park reports no opening hours.Change
self.__next_f.push([1,"..."])calls whose texts, joined, form lines<id>:<json>. The line with"blockType":"calendar-block"holdscalendarData(label id with day ranges) andcolorLegendLabels(id and name).parseCalendar(html)reads that block and returns the same{title, days_selected}events as before, sobuildSchedules()is unchanged. An unreadable or missing block gives[]with a warning, as before.Wintertraum: 11 a.m. – 08 p.m.with a dash instead ofuntil. None of the three 12-hour patterns inparseHours()matched that, so those days would still have dropped out. They are now one pattern that acceptsuntilor a dash.Tests
New
src/parks/phantasialand/__tests__/calendar.test.ts(four tests) with a trimmed copy of the real stream: events and days per label, a day range across a month end, the dash form of the hours, and a page without a calendar block.Checked against the live English page: 143 days, 76 park opening days, 66 Wintertraum days and New Year's Eve.
tsc, the pre-commit hooks and the tests of the park folders pass.🤖 Generated with Claude Code