Add banner to draft and upcoming testdays #128

Merged
jgroman merged 1 commit from feature/56-draft-event-banner into develop 2026-07-03 12:05:37 +00:00
Owner
  • Add banner to warn user when event is in draft state or not-yet-started
  • Add tests covering this feature

Fixes #56

Assisted-by: Claude Code

- Add banner to warn user when event is in draft state or not-yet-started - Add tests covering this feature Fixes #56 Assisted-by: Claude Code
jgroman self-assigned this 2026-06-30 13:44:14 +00:00
Add banner to draft and upcoming testdays
All checks were successful
Run tests / test (pull_request) Successful in 32s
AI Code Review / ai-review (pull_request_target) Successful in 25s
7cbdfc7601
- Add banner to warn user when event is in draft state or not-yet-started
- Add tests covering this feature

Fixes #56

Assisted-by: Claude Code
jgroman changed title from WIP: Add banner to draft and upcoming testdays to Add banner to draft and upcoming testdays 2026-06-30 14:02:02 +00:00

AI Code Review

📋 MR Summary

Adds warning banners to test day pages for events that are in 'draft' or 'upcoming' states.

  • Key Changes:
    • Added logic in testdays/controllers/main.py to calculate the event_state (draft, upcoming, live) based on the test day's draft status and start date.
    • Updated testdays/components/Testday.jinja to display Bulma-style message banners depending on the calculated event_state.
    • Added functional tests in tests/functional/test_main.py to ensure proper behavior across all event states.
  • Impact: testdays/controllers/main.py, testdays/components/Testday.jinja, tests/functional/test_main.py
  • Risk Level: 🟢 Low - The changes are primarily UI-focused (adding banners) and the accompanying logic is non-destructive and isolated. Test coverage is robust.

Detailed Code Review

The implementation correctly identifies the event's lifecycle state and adds clear, user-friendly banners to warn against premature test submissions. The functional tests are well-structured and cover the expected edge cases (draft, upcoming, live, and past).

One potential issue to verify is whether ZoneInfo is properly imported in testdays/controllers/main.py, as it was added to the module's logic without a corresponding import visible in the diff. If it's missing, it will cause a NameError at runtime.

📂 File Reviews

📄 `testdays/controllers/main.py` - Calculates `event_state` to be passed into the template.
  • Major [Bug]: The ZoneInfo class is used to fetch the timezone, but it is not imported in the visible diff. If ZoneInfo is not already imported at the top of the file, this will throw a NameError when triggered.
    • Suggestion: Ensure that ZoneInfo is imported from the zoneinfo module.
from zoneinfo import ZoneInfo

Summary

  • Overall Assessment: The logic and functionality are sound and well-tested, but ensure the ZoneInfo module is imported to avoid runtime crashes.
  • Priority Issues:
    • Verify and potentially add the missing from zoneinfo import ZoneInfo import in testdays/controllers/main.py.
  • Minor Suggestions:
    • If the 'Etc/GMT+12' timezone logic is used in multiple places, consider extracting it to a constant or utility function to avoid duplication and maintain consistency.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.1-pro-preview

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### 📋 MR Summary Adds warning banners to test day pages for events that are in 'draft' or 'upcoming' states. - **Key Changes:** - Added logic in `testdays/controllers/main.py` to calculate the `event_state` (draft, upcoming, live) based on the test day's draft status and start date. - Updated `testdays/components/Testday.jinja` to display Bulma-style message banners depending on the calculated `event_state`. - Added functional tests in `tests/functional/test_main.py` to ensure proper behavior across all event states. - **Impact:** testdays/controllers/main.py, testdays/components/Testday.jinja, tests/functional/test_main.py - **Risk Level:** 🟢 Low - The changes are primarily UI-focused (adding banners) and the accompanying logic is non-destructive and isolated. Test coverage is robust. ### Detailed Code Review The implementation correctly identifies the event's lifecycle state and adds clear, user-friendly banners to warn against premature test submissions. The functional tests are well-structured and cover the expected edge cases (draft, upcoming, live, and past). One potential issue to verify is whether `ZoneInfo` is properly imported in `testdays/controllers/main.py`, as it was added to the module's logic without a corresponding import visible in the diff. If it's missing, it will cause a `NameError` at runtime. #### 📂 File Reviews <details> <summary><strong>📄 `testdays/controllers/main.py`</strong> - Calculates `event_state` to be passed into the template.</summary> - **Major** [Bug]: The `ZoneInfo` class is used to fetch the timezone, but it is not imported in the visible diff. If `ZoneInfo` is not already imported at the top of the file, this will throw a `NameError` when triggered. - *Suggestion:* Ensure that `ZoneInfo` is imported from the `zoneinfo` module. ```` from zoneinfo import ZoneInfo ```` </details> ### ✅ Summary - **Overall Assessment:** The logic and functionality are sound and well-tested, but ensure the `ZoneInfo` module is imported to avoid runtime crashes. - **Priority Issues:** - Verify and potentially add the missing `from zoneinfo import ZoneInfo` import in `testdays/controllers/main.py`. - **Minor Suggestions:** - If the 'Etc/GMT+12' timezone logic is used in multiple places, consider extracting it to a constant or utility function to avoid duplication and maintain consistency. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.1-pro-preview` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
jgroman changed title from Add banner to draft and upcoming testdays to WIP: Add banner to draft and upcoming testdays 2026-06-30 14:05:52 +00:00
Author
Owner
No description provided.
Author
Owner
No description provided.
jgroman changed title from WIP: Add banner to draft and upcoming testdays to Add banner to draft and upcoming testdays 2026-07-02 11:00:03 +00:00
jgroman requested review from kparal 2026-07-02 11:00:09 +00:00
Owner

LGTM 👍

LGTM 👍
jgroman merged commit 7cbdfc7601 into develop 2026-07-03 12:05:37 +00:00
jgroman deleted branch feature/56-draft-event-banner 2026-07-03 12:05:37 +00:00
Owner

This is great, thanks a lot!

My only nitpick is that "This Test Day Is Not Live Yet" is hard for me to read with all the words capitalized 🙂️ But English-native users are probably more used to this.

This is great, thanks a lot! My only nitpick is that "This Test Day Is Not Live Yet" is hard for me to read with all the words capitalized 🙂️ But English-native users are probably more used to this.
Owner

No, I agree, it's weird to a native speaker too. Please use regular sentence capitalization.

No, I agree, it's weird to a native speaker too. Please use regular sentence capitalization.
kparal referenced this pull request from a commit 2026-07-14 08:14:59 +00:00
Owner

Pushed 60dfa4066c to address it.

Pushed 60dfa4066cd95dc8ba53752ce06bab0f3dfac51b to address it.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
quality/testdays-web!128
No description provided.