Asp/default-day-bug#417
Conversation
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/app/studyrooms/page.tsx">
<violation number="1" location="src/app/studyrooms/page.tsx:191">
P2: Reset committed date/time when no fallback day returns results to avoid rendering stale search context from a previous successful query.</violation>
</file>
<file name="src/lib/rooms/utils.ts">
<violation number="1" location="src/lib/rooms/utils.ts:19">
P2: `getNextHalfHour` can round backward for times like `HH:00:ss` or `HH:30:ss` because seconds/milliseconds are ignored when calculating the next boundary.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/lib/rooms/utils.ts">
<violation number="1" location="src/lib/rooms/utils.ts:18">
P2: Rounding by epoch milliseconds can misalign local half-hour boundaries; compute the next `:00`/`:30` using local clock fields instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| @@ -35,23 +38,45 @@ const toLocalStr = (d: Date) => { | |||
| return `${h % 12 || 12}:${m.toString().padStart(2, "0")}${h >= 12 ? "pm" : "am"}`; | |||
| }; | |||
There was a problem hiding this comment.
nit: can probably be moved into a utils.ts file
| function getDefaultWindow() { | ||
| const start = getNextHalfHour(); | ||
| const fivePm = new Date(start); | ||
| fivePm.setHours(17, 0, 0, 0); | ||
|
|
||
| if (start >= fivePm) { | ||
| const nextDay = new Date(start); | ||
| nextDay.setDate(nextDay.getDate() + 1); | ||
| nextDay.setHours(11, 0, 0, 0); | ||
| const end = new Date(nextDay); | ||
| end.setHours(17, 0, 0, 0); | ||
| return { start: nextDay, end }; | ||
| } |
There was a problem hiding this comment.
nit: move to utils.ts file
|
The logic for calculating the start time works great! However, I feel like the end time could be adjusted accordingly. The end time is currently hardcoded to be 5:00, but I think we should keep a 6 hour time window from the start/end EX: Start time 3:00, end time 9:00 TLDR: It would be nice to have a fixed window where the start and end time are both dynamic. |
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/lib/rooms/utils.ts">
<violation number="1" location="src/lib/rooms/utils.ts:237">
P2: The 11 PM rollover check fails when `start` rounds to the next day, resulting in an inconsistent default time window.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
ethancha0
left a comment
There was a problem hiding this comment.
Awesome job, Thanks Arya!
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡶⠓⢷⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⠃⠀⠀⠘⣦⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢠⣴⣶⣶⣤⣠⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣛⠇⠀⠀⠀⠀⣏⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢻⠀⠀⠈⠉⠻⣟⣾⣤⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣺⣟⡳⢿⠐⠠⡀⠀⠀⢸⡅⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢨⡟⠀⠀⠀⠀⠀⠈⠳⣭⢟⡷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣾⠷⣭⣛⢧⡈⠅⡒⠄⠀⢸⡁⠀⠀⠁⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠀⠸⣿⣾⣿⣿⣦⡄⡀⠀⡀⣤⣴⣴⣿⠿⠷⠿⠿⠿⠿⠿⣶⣿⣿⣤⠸⣤⢻⡄⢸⡇⠀⠀⠀⠀⠀⠀
⠀⠀⡀⠀⠀⠀⠀⠈⣿⠀⠀⠀⠀⠀⠀⣀⠠⠘⣯⡟⣯⢟⣿⣧⡤⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⢧⣀⠏⡁⢘⡧⠀⠀⠀⠀⠀⠀
⠀⠀⠐⠃⠀⠀⠀⠐⢿⠀⠀⠀⠀⢀⠰⢀⠣⢁⡿⡽⣎⣿⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⣻⣧⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⠀⠀⠀⠀⠆⢡⠊⢄⠃⣸⡗⣯⡛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣴⣦⣝⢯⣄⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠹⡆⠀⠀⢈⠰⠁⡌⠢⢌⣷⢯⡓⠀⠀⣀⣤⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣧⣽⣿⣿⡟⠀⣷⣤⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠰⢧⠀⠀⠠⡁⠎⡠⢑⡾⣝⣾⠀⠀⣾⣷⣤⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⠿⠿⠟⠋⠠⠄⠷⢿⣶⡀⠀⠀
⠀⠀⠀⠐⠀⠀⠀⠀⠀⠹⣇⠀⠀⠁⢂⣡⣾⢻⡜⣿⠀⠀⠙⠻⠿⢿⣿⣿⣿⣿⠇⠀⠀⠀⠀⡄⣠⢠⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⡷⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠩⣻⡗⣶⢫⡟⣮⢷⡹⣽⠲⠒⠀⠀⠀⠀⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⢣⠏⠀⠀⠀⠀⢀⣨⠰⠛⠁⠀⠀⠈⣛⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢹⣾⡝⣾⡱⣏⡷⣹⢇⠀⠀⠀⠀⠀⢔⡴⢀⢀⣀⣀⡀⣀⡤⠰⠁⠙⠡⠶⠜⠃⠁⠀⠀⠀⠀⠀⠂⠀⣯⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⢟⣾⡽⣎⢷⣭⣛⠷⣦⠀⠀⠀⠀⠀⠈⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⣸⠅⠀⠀
⠀⠀⠀⠀⠀⠐⠅⠀⠀⠀⠀⠀⠀⠀⢽⡿⣼⡹⣞⢶⣫⢟⡅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⣰⠏⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢘⣿⢳⢧⣻⢼⣫⢞⠝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠔⠁⠀⠀⠀⡸⠇⠀⠀⠀⠀
⡤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣯⣛⢮⡳⣏⡾⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⢶⣫⢏⡷⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡏⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣟⣮⠳⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣼⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣂⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣨⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣯⡀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣘⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢷⠄⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣽⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⡗⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢘⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣏⡀
⠀⠀⠀⠀⠀⠀⠀⢀⣽⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡁
⠀⠀⠀⠀⠀⠀⠀⠈⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣷
⠀⠀⠀⠀⠀⠀⠀⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡧
⠀⠀⠀⠀⠀⠀⠀⣾⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣷
Description
This fixes the default day on load for the /studyrooms. It provides a fallback if there is no room results found for up to 7 days into the future for any rooms and displays the room results on whichever day it finds.
For the starting load, it displays times from 11am to 5pm.
For the user query, it displays times from the time range given by the user.
The display of results have also been modified so that pv is shown last when sorted by capacity and there are no "deleted" rooms that the api returns.
Closes #393