Skip to content

Asp/default-day-bug#417

Merged
masterdabber merged 10 commits intomainfrom
asp/default-day_bug
Apr 29, 2026
Merged

Asp/default-day-bug#417
masterdabber merged 10 commits intomainfrom
asp/default-day_bug

Conversation

@masterdabber
Copy link
Copy Markdown
Contributor

@masterdabber masterdabber commented Apr 20, 2026

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

@masterdabber masterdabber temporarily deployed to staging-417 April 20, 2026 11:07 — with GitHub Actions Inactive
@github-actions github-actions Bot temporarily deployed to staging-417 April 20, 2026 11:08 Inactive
@masterdabber masterdabber temporarily deployed to staging-417 April 20, 2026 11:14 — with GitHub Actions Inactive
@github-actions github-actions Bot temporarily deployed to staging-417 April 20, 2026 11:14 Inactive
@masterdabber masterdabber temporarily deployed to staging-417 April 28, 2026 19:35 — with GitHub Actions Inactive
@github-actions github-actions Bot temporarily deployed to staging-417 April 28, 2026 19:35 Inactive
@masterdabber masterdabber marked this pull request as ready for review April 28, 2026 19:51
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/app/studyrooms/page.tsx
Comment thread src/lib/rooms/utils.ts Outdated
@masterdabber masterdabber temporarily deployed to staging-417 April 28, 2026 20:04 — with GitHub Actions Inactive
@github-actions github-actions Bot temporarily deployed to staging-417 April 28, 2026 20:05 Inactive
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/lib/rooms/utils.ts Outdated
@masterdabber masterdabber temporarily deployed to staging-417 April 28, 2026 20:37 — with GitHub Actions Inactive
@github-actions github-actions Bot temporarily deployed to staging-417 April 28, 2026 20:37 Inactive
Comment thread src/app/studyrooms/page.tsx Outdated
Comment on lines 35 to 39
@@ -35,23 +38,45 @@ const toLocalStr = (d: Date) => {
return `${h % 12 || 12}:${m.toString().padStart(2, "0")}${h >= 12 ? "pm" : "am"}`;
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can probably be moved into a utils.ts file

Comment thread src/app/studyrooms/page.tsx Outdated
Comment on lines +41 to +53
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 };
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move to utils.ts file

@ethancha0
Copy link
Copy Markdown
Collaborator

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
EX: Start time 4:00, end time 10:00
EX: Start time 5:00, end time 11:00
EX: Start time 6:00, end time 11:00

TLDR: It would be nice to have a fixed window where the start and end time are both dynamic.

@masterdabber masterdabber temporarily deployed to staging-417 April 29, 2026 20:56 — with GitHub Actions Inactive
@github-actions github-actions Bot temporarily deployed to staging-417 April 29, 2026 20:56 Inactive
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/lib/rooms/utils.ts Outdated
@masterdabber masterdabber temporarily deployed to staging-417 April 29, 2026 21:13 — with GitHub Actions Inactive
@github-actions github-actions Bot temporarily deployed to staging-417 April 29, 2026 21:13 Inactive
@ethancha0 ethancha0 self-requested a review April 29, 2026 21:49
Copy link
Copy Markdown
Collaborator

@ethancha0 ethancha0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job, Thanks Arya!

⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡶⠓⢷⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⠃⠀⠀⠘⣦⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢠⣴⣶⣶⣤⣠⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣛⠇⠀⠀⠀⠀⣏⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢻⠀⠀⠈⠉⠻⣟⣾⣤⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣺⣟⡳⢿⠐⠠⡀⠀⠀⢸⡅⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢨⡟⠀⠀⠀⠀⠀⠈⠳⣭⢟⡷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣾⠷⣭⣛⢧⡈⠅⡒⠄⠀⢸⡁⠀⠀⠁⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠀⠸⣿⣾⣿⣿⣦⡄⡀⠀⡀⣤⣴⣴⣿⠿⠷⠿⠿⠿⠿⠿⣶⣿⣿⣤⠸⣤⢻⡄⢸⡇⠀⠀⠀⠀⠀⠀
⠀⠀⡀⠀⠀⠀⠀⠈⣿⠀⠀⠀⠀⠀⠀⣀⠠⠘⣯⡟⣯⢟⣿⣧⡤⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⢧⣀⠏⡁⢘⡧⠀⠀⠀⠀⠀⠀
⠀⠀⠐⠃⠀⠀⠀⠐⢿⠀⠀⠀⠀⢀⠰⢀⠣⢁⡿⡽⣎⣿⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⣻⣧⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⠀⠀⠀⠀⠆⢡⠊⢄⠃⣸⡗⣯⡛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣴⣦⣝⢯⣄⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠹⡆⠀⠀⢈⠰⠁⡌⠢⢌⣷⢯⡓⠀⠀⣀⣤⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣧⣽⣿⣿⡟⠀⣷⣤⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠰⢧⠀⠀⠠⡁⠎⡠⢑⡾⣝⣾⠀⠀⣾⣷⣤⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⠿⠿⠟⠋⠠⠄⠷⢿⣶⡀⠀⠀
⠀⠀⠀⠐⠀⠀⠀⠀⠀⠹⣇⠀⠀⠁⢂⣡⣾⢻⡜⣿⠀⠀⠙⠻⠿⢿⣿⣿⣿⣿⠇⠀⠀⠀⠀⡄⣠⢠⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⡷⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠩⣻⡗⣶⢫⡟⣮⢷⡹⣽⠲⠒⠀⠀⠀⠀⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⢣⠏⠀⠀⠀⠀⢀⣨⠰⠛⠁⠀⠀⠈⣛⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢹⣾⡝⣾⡱⣏⡷⣹⢇⠀⠀⠀⠀⠀⢔⡴⢀⢀⣀⣀⡀⣀⡤⠰⠁⠙⠡⠶⠜⠃⠁⠀⠀⠀⠀⠀⠂⠀⣯⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⢟⣾⡽⣎⢷⣭⣛⠷⣦⠀⠀⠀⠀⠀⠈⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⣸⠅⠀⠀
⠀⠀⠀⠀⠀⠐⠅⠀⠀⠀⠀⠀⠀⠀⢽⡿⣼⡹⣞⢶⣫⢟⡅⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⣰⠏⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢘⣿⢳⢧⣻⢼⣫⢞⠝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠔⠁⠀⠀⠀⡸⠇⠀⠀⠀⠀
⡤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣯⣛⢮⡳⣏⡾⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⢶⣫⢏⡷⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡏⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣟⣮⠳⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣼⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣂⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣨⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣯⡀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣘⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢷⠄⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣽⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⡗⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢘⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣏⡀
⠀⠀⠀⠀⠀⠀⠀⢀⣽⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡁
⠀⠀⠀⠀⠀⠀⠀⠈⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣷
⠀⠀⠀⠀⠀⠀⠀⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡧
⠀⠀⠀⠀⠀⠀⠀⣾⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣷

@masterdabber masterdabber merged commit 019201b into main Apr 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rooms: Default Day

2 participants