diff --git a/mo/db.py b/mo/db.py index 141fb727a38de304e0b935506332fa0cadf52c3f..6309a5a93483f88ee44b446d8eb3b312a498bc4d 100644 --- a/mo/db.py +++ b/mo/db.py @@ -190,9 +190,9 @@ round_score_mode_names = { # V DB jako numeric(2,1), používá se tak snadněji, než enum round_points_step_names = { - 1: "Celé body", - 0.5: "Půlbody", - 0.1: "Desetinné body", + decimal.Decimal('1'): "Celé body", + decimal.Decimal('0.5'): "Půlbody", + decimal.Decimal('0.1'): "Desetinné body", } round_points_step_choices = round_points_step_names.items() @@ -259,8 +259,8 @@ class Round(Base): return self.state def points_step_name(self) -> str: - if float(self.points_step) in round_points_step_names: - return round_points_step_names[float(self.points_step)] + if self.points_step in round_points_step_names: + return round_points_step_names[self.points_step] return str(self.points_step) diff --git a/mo/web/org_round.py b/mo/web/org_round.py index 08864412158c168f58e4f9da01678caa96939e78..446c29d315c0ea297c48ec0a6abc9bcb5264969e 100644 --- a/mo/web/org_round.py +++ b/mo/web/org_round.py @@ -442,7 +442,7 @@ class RoundEditForm(FlaskForm): description="Řešitelé s alespoň tolika body budou označeni za úspěšné řešitele, prázdná hodnota = žádné neoznačovat", ) points_step = wtforms.SelectField( - "Přesnost bodování", choices=db.round_points_step_choices, + "Přesnost bodování", choices=db.round_points_step_choices, coerce=decimal.Decimal, description="Ovlivňuje možnost zadávání nových bodů, již uložené body nezmění" ) has_messages = wtforms.BooleanField("Zprávičky pro účastníky (aktivuje možnost vytvářet novinky zobrazované účastníkům)")