Skip to content

feat(reports): open new reports at daily hours, with an optional live session link - #1623

Merged
sickerine merged 15 commits into
devfrom
feat/report-daily-hours
Nov 28, 2026
Merged

sickerine merged 15 commits into
devfrom
feat/report-daily-hours

Conversation

@sickerine

Copy link
Copy Markdown
Collaborator

For the Publithon at Africa Evidence Week (Mon 30 Nov to Fri 4 Dec, 12:00 to 13:00 GMT). The 24 November build (#1527) let new reports open between two dates, but not for a set hour each day.

Settings > Publications > New reports

  • With Between dates, a Daily hours row offers All day or Set hours: a start time, an end time and weekday switches, read on the timezone the admin picked. When the dates span two weeks or less, each day is drawn with its state: Done, Open now, its opening time, or Closed.
  • A new Live session section takes an optional link and name, and says whether the link opens the call or a sign-up page. A Zoom registration link is recognised as a sign-up page automatically.
  • Saving one date no longer remounts the row and clears what's being typed in the other. The same applies to the hours and the link fields.

Publish page

  • Outside the hours, the page says "New reports open at set hours" and gives the hours, the days and the next opening. New report, Next and Activate wait. Times show in the reader's own timezone, labelled by GMT offset.
  • A call link shows Join meeting while new reports are open, and greyed out until the next opening otherwise. A sign-up link shows Sign up on Zoom whenever a session is still to come, with "Zoom emails you the link to join."
  • The boxes above the reports list sit 16px from the card's top, sides and bottom.

Server

  • reportSettings.intake gains optional hours and meeting. Rows saved before this keep working, so no migration is needed. save takes and checks both.
  • refuseClosed refuses signing and activating outside the hours. A day's limit, once full, reopens at the next day's hours rather than at midnight. A limit that never reopens shows as full rather than "opens at the next hours".
  • On the night the clocks go back, the hours end the first time the clock reaches their end time.

Checks

  • npx tsc --noEmit, check:ui-rules and check:convex-rules pass.
  • Vitest: lib/reports/intake.test.ts, convex/reports/flow.test.ts and convex/reports/activation.test.ts, 97 passed. New cases cover the hours, picked days, timezone, a day's limit, a limit that never reopens, the night the clocks go back, days drawn within the dates, the checks on save, and signing refused on a day not picked.
  • Browser, on a throwaway Convex deployment: hours, a Zoom sign-up link, its name and its type saved and survived a reload. The Publish page showed the sign-up bar while open, the set-hours notice with Sign up on Zoom between hours, and the full-limit notice with the sign-up button.
  • GPT-6.1 Sol review: six findings, all fixed in the second commit.

All 13 languages carry the new strings.

Between dates gets Daily hours: all day, or from and to times on picked
weekdays, with each day drawn and how far through its hours now is. A
meeting link (Zoom, Google Meet, Teams or any call) is optional: authors
see a Join button on the Publish page while new reports are open, and a
shut one with the next opening while they wait for the hours. Mock state
lives in this browser, so shared dev's settings are never changed.
…s sign-up page

A Zoom registration link is told apart by its address and offers Sign up
on Zoom at any time, with Zoom emailing the link to join; a call's link
still offers Join only while new reports are open. The Publithon setup
uses the Africa Evidence Week registration.
… session link

Between dates can open only during set hours on picked weekdays, read on
the admin's timezone clock. Signing and activating are refused outside
them, a day's limit reopens at the next day's hours, and the Publish page
says when they open next in the reader's own time.

An optional session link shows on the Publish page: the call, joined
while new reports are open, or its sign-up page (Zoom registration is
recognised), open whenever a session is still to come.

Saving one date no longer drops what is being typed in the other.
Hours on the night clocks go back end the first time the clock reads
their end. A limit that never reopens is said to be full rather than
waiting for the next hours. Drawn days stay within the dates. The notice
reads the true end and the reader's weekdays from the days the hours
really fall on. Hours saved elsewhere go into their boxes.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a65f6fe5-8d3b-476e-89e7-bc397352f67d
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T22:01:39.972710Z 458eb51 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 458eb519d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/reports/intake.ts
* the first time round, so hours on the night clocks go back are no longer than on any other.
*/
function onClock(year: number, month: number, day: number, minutes: number, timeZone: string) {
const at = zoned(year, month, day, Math.floor(minutes / 60), minutes % 60, timeZone);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clamp skipped opening times to the end of the DST gap

When daily hours start inside a spring-forward gap, zoned() shifts the start forward by the gap rather than to the first valid instant, which can eliminate the entire session. For example, Sunday 02:30–03:30 in America/New_York on 14 March 2027 produces identical start and end instants of 07:30 UTC. At 03:15 local time, intakeAt() consequently reports closed, and refuseClosed() rejects signing and activation; at 03:30 it skips to the following Sunday without ever opening. Resolve skipped clock times to the gap's end so the valid remainder of the configured hours remains available.

Useful? React with 👍 / 👎.

await intake({ mode: "dates", opensAt: Date.now() - 1, closesAt: Date.now() + 3_600_000 });
// Between the dates, but not on a day its hours fall on.
const today = new Date().getUTCDay();
const allDay = { from: 0, to: 24 * 60 - 1 };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Freeze the clock for the daily-hours integration test

When this test runs between 23:59:00 and midnight UTC, the supposedly allDay hours have already ended because to is exclusive. The final sign() therefore rejects with FEATURE_DISABLED instead of returning R100001, causing a time-dependent CI failure. This test and its setup use the real clock; freeze the date at a known time inside the configured hours and restore it afterward.

Useful? React with 👍 / 👎.

Comment on lines +474 to +477
if (end <= start || end - start > DRAWN_DAYS * DAY) return null;
const days = hoursBetween(hours, start, end, timeZone, DRAWN_DAYS);
const sessions = days.filter((day) => day.open);
const left = sessions.filter((day) => day.end > now).length;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include the final calendar date in the session summary

A range of fourteen elapsed days can touch fifteen calendar dates, so it passes the duration guard but is silently truncated by the fourteen-row cap. For example, with UTC dates 30 November 2026 at 12:00 through 14 December at 12:00 and weekday hours 11:00–13:00, the calendar ends on 13 December and omits the valid session on 14 December. At 11:30 that final Monday, the summary reports zero days left even though intake is open. Count the calendar dates before deciding whether to draw this summary, or include every date in the accepted range rather than calculating totals from a truncated list.

Useful? React with 👍 / 👎.

Hours that start in the hour the clocks skip open at the jump rather
than vanishing. The days are drawn only when every calendar day the
dates touch fits, so the summary never misses the last one. The flow
test runs at a fixed noon, not whenever the suite does.
@sickerine
sickerine merged commit ec4ea9f into dev Nov 28, 2026
6 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.

1 participant