Skip to content

fix(cc): include zero-second challenge solves - #557

Open
DevaanshPathak wants to merge 1 commit into
GenAI-Security-Project:mainfrom
DevaanshPathak:agent/fix-issue-556-zero-second-solve-stats
Open

fix(cc): include zero-second challenge solves#557
DevaanshPathak wants to merge 1 commit into
GenAI-Security-Project:mainfrom
DevaanshPathak:agent/fix-issue-556-zero-second-solve-stats

Conversation

@DevaanshPathak

Copy link
Copy Markdown

Summary

  • include completed progress rows whose solve duration is exactly zero seconds
  • preserve zero as a valid per-challenge average in the Command Center template
  • add regression coverage for zero, non-zero, and missing durations plus actual template rendering

Root cause

The statistics helper and template both used truthiness checks for solve durations. Challenge completion stores elapsed time as an integer, so a legitimate sub-second solve becomes 0 and was treated as if the value were missing.

Impact

Fast solves now contribute to average solve-time statistics instead of biasing averages upward. Challenges with a valid zero-second average display 0m rather than a missing-value marker.

Testing

  • uv run pytest tests/unit/apps/cc/test_challenges.py — 3 passed
  • uv run pytest tests/unit/apps — 16 passed
  • uv run black --check tests/unit/apps/cc/test_challenges.py
  • uv run isort --check-only finbot/apps/cc/routes/challenges.py tests/unit/apps/cc/test_challenges.py

Fixes #556

@DevaanshPathak
DevaanshPathak marked this pull request as ready for review August 4, 2026 18:25
Copilot AI lite review requested due to automatic review settings August 4, 2026 18:25

Copilot AI 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.

Pull request overview

Fixes Command Center challenge statistics and rendering so legitimate 0-second solve durations are treated as valid values (not missing), ensuring fast solves contribute to averages and zero averages render as 0m instead of a missing marker.

Changes:

  • Update _challenge_list_with_stats to include completed rows where completion_time_seconds == 0 by filtering on is not None.
  • Update the CC challenges template to render averages when avg_solve_seconds is 0 (distinguishing None vs 0).
  • Add regression tests covering zero, non-zero, and missing durations, including a real template render assertion.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
finbot/apps/cc/routes/challenges.py Fixes stats calculation to include zero-second completed solves in average computation.
finbot/apps/cc/templates/pages/challenges.html Renders 0m for a valid zero average by checking is not none rather than truthiness.
tests/unit/apps/cc/test_challenges.py Adds unit/regression coverage for the zero-duration edge case and template rendering.

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

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.

Bug: Command Center excludes zero-second completions from average solve time

2 participants