Repository navigation
feat(calendar): match the recommendations API on main - #157
Merged
Merged
Conversation
selvarajuv
approved these changes
Nov 27, 2026
Adds lead_days (days from today, 0 for today and past nights), rate_basis "nett" (before VAT, decision 0076) and manager_rate (set on about one night in seven), and a "lead days N" factor as the backend names it. Drops weather_source, which the API no longer sends.
parseAmount turns the API's Decimal strings into numbers, in one place, and keeps null as null. Recommendations also carry rateBasis, leadDays and managerRate from the response.
The calendar asks for tonight and the 29 nights after it in one call (the API allows 90). The month grid shows those nights in whichever month is open, and the previous and next buttons stay within the months they fall in. Days outside the window stay grey.
The model learns and the API returns rates before VAT (decision 0076), so the header, a line beside the colour chips and the hover card say so. The label follows rate_basis: an older model's "arr" rate reads "as the night's average" instead, since the API doesn't say whether it includes VAT.
When the manager has set their own rate for a night, the card shows "Manager's rate €185" next to the recommended rate. It isn't shown in the day cell.
#155 drops `rate_basis` from the recommendations response: every rate is before VAT (decisions 0076, 0082). The mock no longer sends it, the API module no longer maps it, and the "as the night's average" branch is gone; the calendar and hover card say "before VAT" outright. The mock's comment points at the explanation's new home in services/recommendations/.
A long factor name like "December with the night before a public holiday"
squeezed its amount onto two lines ("+" over "€20"). The amount no longer
shrinks or wraps; the name truncates instead.
On real data a night can have 15 factor lines, and the card for a night in the top or bottom row fit neither above nor below it: flip and shift can't help then. Floating UI's size middleware caps the card at the height free on its side, and the card scrolls inside that.
The real model explains a night with up to 15 lines, many of them pairs like "December with the night before a public holiday". The hover card shows the six largest and adds every other one into "Smaller effects combined" before rounding, so the lines still add up to the rate. Recorded in decision 0065.
The API names the one room type it prices "DOUBLE" (decision 0079), so the header read "DOUBLE room". formatRoomType in lib/format.js shows it in sentence case, and the mock now sends "DOUBLE" as the API does.
Jrodrigo06
force-pushed
the
calendar-new-shape
branch
from
November 27, 2026 19:03
c4e1e40 to
705a853
Compare
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.
What
The calendar matches the recommendations API on main after #155. It shows the next 30 nights for the signed-in user's hotel, labels every rate "before VAT", and shows the manager's rate beside ours in the hover card. It also fixes hover-card problems that only real data showed: amounts wrapping, the card running off screen, and too many factor lines (now the six largest plus "Smaller effects combined").
Why
#155 removed
rate_basis,confidence_intervalandcurrency, and decision 0076 says the frontend must say rates are before VAT.How to check
POST /hotels/1/train), runjust frontendwith mocks off and sign in.Screenshots
Hover card on 25 December, real data
Manager's rate beside ours on 5 December
Notes
events_source: "missing", so the model treats event inputs as unknown even though the calendar lists events. That's a data question for the backend.