Skip to content

Commit abb8ebe

Browse files
cfsmp3claude
authored andcommitted
fix: Show correct sample progress on initial page load
Previously the test page hardcoded "0 / 0 samples" and only updated via AJAX after 20 seconds. Now the sample progress is calculated on initial render so users see accurate progress immediately. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 85f9635 commit abb8ebe

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

mod_test/controllers.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,24 @@ def get_data_for_test(test, title=None) -> Dict[str, Any]:
150150

151151
results = get_test_results(test)
152152

153+
# Calculate sample progress for initial page load
154+
completed_samples = len(test.results)
155+
total_samples = len(test.get_customized_regressiontests())
156+
progress_percentage = 0
157+
if total_samples > 0:
158+
progress_percentage = int((completed_samples / total_samples) * 100)
159+
153160
return {
154161
'test': test,
155162
'TestType': TestType,
156163
'results': results,
157164
'title': title,
158-
'avg_minutes': avg_minutes
165+
'avg_minutes': avg_minutes,
166+
'sample_progress': {
167+
'current': completed_samples,
168+
'total': total_samples,
169+
'percentage': progress_percentage
170+
}
159171
}
160172

161173

templates/test/by_id.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ <h1>Test progress for {{ title }}</h1>
6868
{{ stage.description }}
6969
{% if stage.description == 'Testing' and status == 'running' %}
7070
<div class="sample-progress" id="sample-progress">
71-
<small id="sample-progress-text">0 / 0 samples</small>
71+
<small id="sample-progress-text">{{ sample_progress.current }} / {{ sample_progress.total }} samples{% if sample_progress.total > 0 %} ({{ sample_progress.percentage }}%){% endif %}</small>
7272
</div>
7373
{% endif %}
7474
</li>

0 commit comments

Comments
 (0)