Skip to content

Commit

Permalink
Add epsilon for decimal score validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tienne-B committed Mar 4, 2024
1 parent a8fa6b5 commit 88bee2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tabbycat/results/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from decimal import Decimal
from itertools import product
from math import log10

from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
Expand Down Expand Up @@ -75,7 +75,7 @@ def validate(self, value):
self.check_value(value)

def check_value(self, value):
if value and self.step_value and round(value % self.step_value, -(round(log10(self.step_value)) - 1)) != 0:
if value and self.step_value and Decimal(value) % Decimal(self.step_value) == 0:
if self.step_value == 1:
msg = _("Please enter a whole number.")
else:
Expand Down

0 comments on commit 88bee2d

Please sign in to comment.