Skip to content

Conversation

@ronryv
Copy link
Collaborator

@ronryv ronryv commented Jan 24, 2026

Improve notifications for training day attendance and questions

Summary

This PR enhances the admin interface to provide better visibility into unanswered questions and pending delay requests across training days within a training program.

Changes include:

  • Added info messages on announcements/questions pages clarifying they only handle training program-level items, with guidance to visit training day pages
  • Added notification badges (red circles) to the sidebar showing counts of unanswered questions and pending delay requests for each training day
  • Added aggregate notification badges next to the "Training Days" section header
  • Training program questions page now lists training days with unanswered questions with direct links
  • Training program attendance page now lists training days with pending delay requests with direct links
  • Added orange color styling (.unread-delay) to differentiate delay request indicators from question indicators
  • Fixed CSS layout so notification badges stay inline with training day names (using flexbox)

Updates since last revision:

  • Consolidated duplicate code into a single render_params_for_training_program() helper method in base.py that handles setting training_program, contest, unanswered questions count, and training day notifications
  • Updated all training program handlers (trainingprogram.py, student.py, archive.py) to use the consolidated helper method, reducing code duplication significantly (~70 lines removed)
  • Removed redundant notification badge next to "Attendance" menu item since the same information is now visible in the Training Days sidebar section
  • Fixed overview and resourceslist pages to show training day notifications when accessed in a training program context (by detecting if the contest is a managing contest for a training program)

Review & Testing Checklist for Human

  • Performance check: The render_params_for_training_program() in base.py queries unanswered questions and pending delay requests for each training day on every page load within a training program context. Verify this doesn't cause noticeable slowdown with many training days.
  • Visual verification: Test the sidebar displays correctly - red badges for questions, orange badges for delay requests, badges stay inline with training day names (not wrapping to new line)
  • Page coverage: Verify notification badges appear on ALL training program pages including overview and resourceslist (these were specifically reported as missing before)
  • Link verification: Click through the links in the info messages on questions/attendance pages to ensure they navigate to the correct training day pages

Recommended test plan:

  1. Create a training program with multiple training days
  2. Add some unanswered questions and pending delay requests to different training days
  3. Navigate to the training program and verify badges appear in sidebar on ALL pages (including overview and resourceslist)
  4. Verify badges stay inline with training day names (no line wrapping)
  5. Visit the questions page and verify the info message lists training days with unanswered questions
  6. Visit the attendance page and verify the info message lists training days with pending delay requests
  7. Verify badges disappear when all questions are answered / delay requests are resolved

Notes

Summary by CodeRabbit

  • New Features

    • Per-training-day notification badges showing unanswered questions and pending delay requests, with totals at the Training Program level.
    • Lists of training days with unanswered questions and pending delays linking to the relevant pages (Questions, Delays/Extra Times).
    • Informational banners on Announcements and Attendance pages guiding users to relevant training-day views.
  • Style

    • Improved sidebar flex layout and alignment for clearer badge display.
    • New amber/orange badge style for pending-delay notifications.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add clear messages on announcements/questions pages indicating they only
  handle training program items, with links to training day pages
- Add alerts to side menu showing total unanswered questions and pending
  delay requests across all training days
- Add red circles with counts to each training day in the side menu
- Training program questions page now shows alerts for training days with
  unanswered questions with direct links
- Training program attendance page now shows alerts for training days with
  pending delay requests with direct links
- Add orange color styling for delay request indicators to differentiate
  from question indicators (red)

Co-Authored-By: Ron Ryvchin <[email protected]>
@devin-ai-integration
Copy link

devin-ai-integration bot commented Jan 24, 2026

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Centralizes training-program render context via BaseHandler.render_params_for_training_program(), aggregates per-training-day metrics (unanswered questions and pending delay requests), updates many admin handlers to use it, and surfaces these metrics in templates and sidebar styling.

Changes

Cohort / File(s) Summary
Base helper
cms/server/admin/handlers/base.py
Added render_params_for_training_program(training_program) that builds r_params with training_program, contest, per-training-day notifications (unanswered_questions, pending_delay_requests) and cumulative totals.
Archive & attendance handlers
cms/server/admin/handlers/archive.py, cms/server/admin/handlers/trainingday.py
Switched handler r_params initialization to the new helper; added training_days_with_pending_delays usage in attendance/archive flows.
Training program handlers
cms/server/admin/handlers/trainingprogram.py, cms/server/admin/handlers/contest.py
Replaced ad-hoc render param population with helper; moved per-day unanswered/pending-delay logic into helper; added DelayRequest import.
Student & misc handlers
cms/server/admin/handlers/student.py
Replaced duplicated r_params setup with helper calls; preserved per-page overrides where needed (e.g., deletion flows).
Templates
cms/server/admin/templates/base.html, cms/server/admin/templates/questions.html, cms/server/admin/templates/announcements.html, cms/server/admin/templates/training_program_attendance.html
Render new badges/notification blocks and conditional informational banners driven by training-program notification data (per-day unread and pending-delay badges, totals).
Styling
cms/server/admin/static/aws_style.css
Added flex-based sidebar layout, badge styles, and .unread.unread-delay / .sidebar-badge.is-amber for pending-delay visuals.

Sequence Diagram(s)

(Skipped — changes are refactor/UI/data-aggregation focused and do not introduce a new multi-component sequential flow that requires diagramming.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Daniel-Aga

Poem

🐰 I hopped through params, neat and spry,
Collected delays beneath the sky,
Badges glow amber, red, and bright,
Templates sing with clearer light,
One helper now keeps context tight. 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main objectives of the PR: improving notifications for training day attendance and questions across multiple handlers and templates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

Comment @coderabbitai help to get the list of available commands and usage tips.

devin-ai-integration bot and others added 2 commits January 24, 2026 17:25
- Refactor render_params_for_training_program() to include contest, unanswered
  questions count, and training day notifications in a single helper method
- Update all training program handlers to use the consolidated helper method
- Remove duplicate code for setting training_program, contest, unanswered params
- Remove redundant Attendance badge from sidebar (now shown in Training Days)
- Fix CSS layout so notification badges stay inline with training day names

Co-Authored-By: Ron Ryvchin <[email protected]>
When the contest is a managing contest for a training program, use
render_params_for_training_program() to show training day notifications
in the sidebar on the overview and resourceslist pages.

Co-Authored-By: Ron Ryvchin <[email protected]>
@ronryv
Copy link
Collaborator Author

ronryv commented Jan 24, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ronryv
Copy link
Collaborator Author

ronryv commented Jan 24, 2026

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

✅ Actions performed

Full review triggered.

@ronryv ronryv merged commit b0d3219 into training_program Jan 24, 2026
5 checks passed
ronryv added a commit that referenced this pull request Jan 29, 2026
* Improve notifications for training day attendance and questions

- Add clear messages on announcements/questions pages indicating they only
  handle training program items, with links to training day pages
- Add alerts to side menu showing total unanswered questions and pending
  delay requests across all training days
- Add red circles with counts to each training day in the side menu
- Training program questions page now shows alerts for training days with
  unanswered questions with direct links
- Training program attendance page now shows alerts for training days with
  pending delay requests with direct links
- Add orange color styling for delay request indicators to differentiate
  from question indicators (red)

Co-Authored-By: Ron Ryvchin <[email protected]>

* Consolidate training program render params into helper method

- Refactor render_params_for_training_program() to include contest, unanswered
  questions count, and training day notifications in a single helper method
- Update all training program handlers to use the consolidated helper method
- Remove duplicate code for setting training_program, contest, unanswered params
- Remove redundant Attendance badge from sidebar (now shown in Training Days)
- Fix CSS layout so notification badges stay inline with training day names

Co-Authored-By: Ron Ryvchin <[email protected]>

* Add training day notifications to overview and resourceslist pages

When the contest is a managing contest for a training program, use
render_params_for_training_program() to show training day notifications
in the sidebar on the overview and resourceslist pages.

Co-Authored-By: Ron Ryvchin <[email protected]>

* Notifications on right + new util useage

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

2 participants