diff --git a/mo/score.py b/mo/score.py index 24a211a3ef07a7055bf08e30c4c9a78a27877b2d..ebb9cd97beb4ee53bd61cd4c8a07c6fda1cb6e3c 100644 --- a/mo/score.py +++ b/mo/score.py @@ -280,6 +280,12 @@ class Score: tasks.append(task.task) return list(sorted(tasks, key=lambda task: task.code)) + def get_task_difficulties(self) -> Dict[db.Task, Fraction]: + diffs = {} + for task in self._tasks[0].values(): + diffs[task.task] = task.get_difficulty() + return diffs + def _add_message(self, type: str, message: str): self._messages.append((type, message)) diff --git a/mo/web/org_score.py b/mo/web/org_score.py index e004e44bf2cffe5526ad8c73e6cb6d9c7cd0cd2d..88b58005a3df84e09965a37f8bfd815efd7fe67a 100644 --- a/mo/web/org_score.py +++ b/mo/web/org_score.py @@ -90,6 +90,7 @@ def org_score(round_id: Optional[int] = None, hier_id: Optional[int] = None, ct_ score = Score(round.master, contest, ctx.hier_place) tasks = score.get_tasks() + difficulties = score.get_task_difficulties() results = score.get_sorted_results() messages = score.get_messages() @@ -249,8 +250,9 @@ def org_score(round_id: Optional[int] = None, hier_id: Optional[int] = None, ct_ return render_template( 'org_score.html', ctx=ctx, - tasks=tasks, + tasks=tasks, difficulties=difficulties, table=table, messages=messages, + num_results=len(results), group_rounds=group_rounds, snapshots_count=snapshots_count, edit_form=edit_form, snapshot_form=snapshot_form, diff --git a/mo/web/templates/org_score.html b/mo/web/templates/org_score.html index ea19c22d0dc04235797a7e139c1ff3a8dd30e374..c79e824d41992812f9bf03ef058c9b5d28df2497 100644 --- a/mo/web/templates/org_score.html +++ b/mo/web/templates/org_score.html @@ -90,6 +90,26 @@ Rozkliknutím bodů se lze dostat na detail daného řešení.</p> {{ table.to_html() }} +<div class="collapsible"> + <input type="checkbox" class="toggle" id="stats-toggle"> + <label for="stats-toggle" class="toggle toggle-small"> + Statistiky + </label> + <div class="collapsible-inner"> + <ul> + <li>Listina obsahuje celkem {{ num_results|inflected('účastníka', 'účastníky', 'účastníků') }}. + {% if num_results > 0 %} + <li>Průměrné počty bodů za úlohy: + <ul> + {% for t in tasks %} + <li>{{ t.code }}: {{ difficulties[t] }} + {% endfor %} + </ul> + {% endif %} + </ul> + </div> +</div> + {% if edit_form %} {{ wtf.form_field(edit_form.submit, class="btn btn-primary pull-right") }} </form>