From 976c399b836a7e824417bb2ed95346f9c71edf24 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Mon, 8 Mar 2021 16:31:41 +0100
Subject: [PATCH] =?UTF-8?q?mo.score:=20P=C5=99ehledn=C4=9Bj=C5=A1=C3=AD=20?=
 =?UTF-8?q?zobrazov=C3=A1n=C3=AD=20obt=C3=AD=C5=BEnosti=20=C3=BAloh?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Obtížnost ukazujeme jak jako nezkrácený zlomek (takže je vidět,
že byli započítání i účastníci bez submitů), tak jako číslo s pevným
počtem desetinných míst.
---
 mo/score.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mo/score.py b/mo/score.py
index 82efa495..8d7280ea 100644
--- a/mo/score.py
+++ b/mo/score.py
@@ -79,6 +79,9 @@ class ScoreTask:
             return Fraction(0)
         return Fraction(self.sum_points, self.num_solutions)
 
+    def get_difficulty_str(self) -> str:
+        return f'{self.sum_points}/{self.num_solutions}'
+
 
 class Score:
     round: db.Round
@@ -327,7 +330,7 @@ class Score:
                         f"Úlohy {last_task.task.code} a {task.task.code} mají stejnou vypočtenou obtížnost"
                         + f" {difficulty}, pro výpočet obtížnosti je řadím podle kódu úlohy"
                     )
-                difficulty_report.append(f"{task.task.code} ({round(float(difficulty), 2)} b)")
+                difficulty_report.append(f"{task.task.code} ({task.get_difficulty_str()}={float(difficulty):.2f})")
                 last_task, last_difficulty = task, difficulty
 
             self._add_message(
-- 
GitLab