Skip to content

Add a Score counter to task overview#1476

Open
pxsit wants to merge 42 commits intocms-dev:mainfrom
pxsit:add-counter
Open

Add a Score counter to task overview#1476
pxsit wants to merge 42 commits intocms-dev:mainfrom
pxsit:add-counter

Conversation

@pxsit
Copy link
Copy Markdown
Contributor

@pxsit pxsit commented Jul 23, 2025

Add a Score counter to task overview
image

@prandla
Copy link
Copy Markdown
Member

prandla commented Jul 23, 2025

I have some comments about the code, but i'm wondering if this is the UI we want in the first place... I saw some browser extension that showed the task scores on the sidebar next to the task links, maybe that would be better.

Does anyone else have any thoughts?

@Muaath5
Copy link
Copy Markdown

Muaath5 commented Jul 28, 2025

I have some comments about the code, but i'm wondering if this is the UI we want in the first place... I saw some browser extension that showed the task scores on the sidebar next to the task links, maybe that would be better.

Does anyone else have any thoughts?

I don't see any issues if both of these ways where implemented, but if it was in the task overview it would be better in case of onsite competitions and you don't want others to look into your score :)

@pxsit
Copy link
Copy Markdown
Contributor Author

pxsit commented Aug 1, 2025

I have some comments about the code, but i'm wondering if this is the UI we want in the first place... I saw some browser extension that showed the task scores on the sidebar next to the task links, maybe that would be better.
Does anyone else have any thoughts?

I don't see any issues if both of these ways where implemented, but if it was in the task overview it would be better in case of onsite competitions and you don't want others to look into your score :)

Added an option to toggle this in AWS (:

Reformat, Fix Updaters, more
@pxsit
Copy link
Copy Markdown
Contributor Author

pxsit commented Aug 4, 2025

image Im still getting this bug, let me try fix it

@pxsit
Copy link
Copy Markdown
Contributor Author

pxsit commented Aug 4, 2025

Should be fixed! (According to my testing)

@prandla
Copy link
Copy Markdown
Member

prandla commented Aug 4, 2025

Sorry, I just looked at the rest of cws_style.css, and now I think your original approach was the best... I thought the places you changed were the only places that defined these colors, but looks like there are quite a few other places that use slightly different colors, so explicitly defining that these colors are in the task overview table and in the submission list table is fine.

After reverting that it should be good to merge.

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 12.06897% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.59%. Comparing base (727005d) to head (ef00a6a).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cms/server/contest/handlers/contest.py 11.76% 30 Missing ⚠️
cms/server/contest/handlers/main.py 5.88% 16 Missing ⚠️
cms/server/contest/handlers/tasksubmission.py 0.00% 3 Missing ⚠️
cms/server/admin/handlers/contest.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1476      +/-   ##
==========================================
- Coverage   54.67%   54.59%   -0.09%     
==========================================
  Files         336      336              
  Lines       27450    27507      +57     
==========================================
+ Hits        15009    15017       +8     
- Misses      12441    12490      +49     
Flag Coverage Δ
functionaltests 0.00% <0.00%> (ø)
unittests 54.59% <12.06%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI review requested due to automatic review settings January 1, 2026 06:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds a configurable score counter display to the task overview page in the Contest Web Server (CWS). The feature is controlled by a new boolean field show_task_scores_in_overview that can be configured per contest.

  • Adds database column show_task_scores_in_overview to the contests table with default value of true
  • Implements score calculation and display in the task overview table
  • Extends CSS styling to apply score coloring (red/yellow/green) to the task overview scores

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
cmscontrib/updaters/update_from_1.5.sql Adds database migration to create the show_task_scores_in_overview column in the contests table
cms/server/contest/templates/overview.html Adds conditional score column header and data cells to the task overview table
cms/server/contest/static/cws_style.css Extends existing score styling classes to also apply to the main task list
cms/server/contest/handlers/main.py Implements score calculation logic in MainHandler.render_params() and adds necessary imports
cms/server/admin/templates/contest.html Adds checkbox UI element for the new setting in the contest configuration page
cms/server/admin/handlers/contest.py Adds form processing for the new show_task_scores_in_overview field
cms/db/contest.py Adds the show_task_scores_in_overview boolean column definition to the Contest model

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Muaath5
Copy link
Copy Markdown

Muaath5 commented Mar 17, 2026

This is the coolest pull request why it is delayed?

pxsit added 11 commits April 6, 2026 01:03
Introduce an option to display per-task public scores in the contest sidebar. Adds a new DB column (show_task_scores_in_sidebar) and admin checkbox to toggle it, includes CSS badge styling and template changes to render the score next to each task. Backend changes add helpers to load participations with the relations required for scoring and to compute formatted public task scores (only computed when needed and hiding tasks with zero public max in the sidebar). Includes SQL updater to migrate existing databases.
Add logic to display tokened/total task scores in the sidebar when a token has been played on a task or when in analysis phase. Introduce _compute_sidebar_task_scores in the contest handler and switch render_params to use it (passing actual_phase) so sidebar values use tokened scores where appropriate while still hiding tasks with no public score. Templates updated: add data-task-name attribute to task nav headers and add JS to initialize sidebar state, update sidebar badges dynamically (sidebar_use_tokened_score, update_sidebar_task_score) and switch displayed score to tokened totals when submissions reveal full scores. This enables correct initial rendering and real-time updates of sidebar task scores based on token usage and scoring visibility.
Change default for show_task_scores_in_sidebar from False to True in cms/db/contest.py so new contests display task scores in the sidebar by default. Also remove an extraneous blank line from the SQL updater script (formatting cleanup).
Replace separate _compute_public_task_scores and sidebar-specific logic with a single _compute_task_scores method that handles both public and tokened/total scores. The new method accepts actual_phase and a hide_zero_max_public flag (default true) to control whether tasks with zero public max score are shown. Update callers in contest/handlers/contest.py and contest/handlers/main.py to use the unified method and pass appropriate hide_zero_max_public values, preserving previous visibility behavior.
When the contest is in analysis mode (actual_phase == 3) total/task tokened scores are now shown as full scores instead of being limited to tokened submissions. Added joinedload(Participation.user) to the contest handler to eager-load users and avoid extra queries, and replaced per-task any(...) scans with a tokened_task_ids set for efficiency. The task submission handler now checks actual_phase to decide whether to restrict to tokened submissions. The template always renders a task score badge placeholder when sidebar scores are enabled so layout remains consistent. Also clarified related docstrings/comments.
Avoid a duplicate DB query by reusing a participation object that ContestHandler may have preloaded for sidebar scores; only call _load_participation_for_scores when necessary. Compute task scores conditionally as before. UI fixes: display "N/A" for undefined task scores in the contest sidebar, add CSS for the undefined badge state, and ensure task submission badges remove the undefined class and are shown after updating the score.
Add an option to display task scores in the contest sidebar and for both the overview and the sidebard task scores, when a tokened score is availble it will use that score, if not it will use the public score, if there is no public score it will show 0/0 (considering to change to N/A)
@pxsit pxsit requested a review from prandla April 5, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants