Skip to content

Commit

Permalink
Fix: Assertion when no event minute data is available
Browse files Browse the repository at this point in the history
  • Loading branch information
LarchLiu committed Sep 25, 2023
1 parent 88af771 commit 2aa3e20
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tfmkt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ def background_position_in_px_to_minute(px_x: int, px_y: int) -> int:
:rtype: int
"""

if abs(px_y) > 36*12: # no data available
return -1

n = 10 # number of columns in the matrix
m = 13 # number of rows in the matrix
h = 36 # size of the chronometer square in pixels
Expand All @@ -40,6 +37,9 @@ def background_position_in_px_to_minute(px_x: int, px_y: int) -> int:
for a in range(1, m)
]

if abs(px_y) > h*(m - 1 - y_offset): # no data available
return -1

x = abs(px_x) / h
assert x.is_integer()
x = int(x) + x_offset
Expand Down

0 comments on commit 2aa3e20

Please sign in to comment.