Component
finbot/apps/cc/routes/challenges.py::_challenge_list_with_stats
finbot/apps/cc/templates/pages/challenges.html
Problem
The Command Center challenge list excludes completed progress rows when completion_time_seconds is 0:
completed_rows = [
p
for p in progress_rows
if p.status == "completed" and p.completion_time_seconds
]
Zero is a valid completion time. Both challenge-completion paths store the elapsed duration using int(total_seconds()), so any solve completed in under one second is recorded as 0. Because 0 is falsy, these solves are omitted from the average.
The template also uses a truthiness check for avg_solve_seconds, so a valid average of zero is rendered as -.
Steps to reproduce
- Pass
_challenge_list_with_stats a challenge with one UserChallengeProgress row where:
status == "completed"
completion_time_seconds == 0
- Inspect the returned challenge statistics.
Actual result:
{
"completions": 1,
"players": 1,
"avg_solve_seconds": None,
}
Expected result:
{
"completions": 1,
"players": 1,
"avg_solve_seconds": 0,
}
Impact
Fast first-attempt solves are excluded from the average, biasing solve-time statistics upward. Challenges containing only zero-second completions show recorded completions but no average solve time in the Command Center.
Proposed fix
- Include completed rows when
completion_time_seconds is not None rather than testing its truthiness.
- In the template, distinguish
None from a valid zero value when deciding whether to render the metric.
- Add regression coverage for zero-second, non-zero, and missing completion times.
Acceptance criteria
- A completed row with
completion_time_seconds=0 contributes to the average.
- Rows with
completion_time_seconds=None remain excluded.
- A mix of
0 and 10 seconds produces an average of 5 seconds.
- The challenge list does not render a missing-value marker for a valid zero-second average.
Component
finbot/apps/cc/routes/challenges.py::_challenge_list_with_statsfinbot/apps/cc/templates/pages/challenges.htmlProblem
The Command Center challenge list excludes completed progress rows when
completion_time_secondsis0:Zero is a valid completion time. Both challenge-completion paths store the elapsed duration using
int(total_seconds()), so any solve completed in under one second is recorded as0. Because0is falsy, these solves are omitted from the average.The template also uses a truthiness check for
avg_solve_seconds, so a valid average of zero is rendered as-.Steps to reproduce
_challenge_list_with_statsa challenge with oneUserChallengeProgressrow where:status == "completed"completion_time_seconds == 0Actual result:
{ "completions": 1, "players": 1, "avg_solve_seconds": None, }Expected result:
{ "completions": 1, "players": 1, "avg_solve_seconds": 0, }Impact
Fast first-attempt solves are excluded from the average, biasing solve-time statistics upward. Challenges containing only zero-second completions show recorded completions but no average solve time in the Command Center.
Proposed fix
completion_time_seconds is not Nonerather than testing its truthiness.Nonefrom a valid zero value when deciding whether to render the metric.Acceptance criteria
completion_time_seconds=0contributes to the average.completion_time_seconds=Noneremain excluded.0and10seconds produces an average of5seconds.