Skip to content

Commit

Permalink
Checker: cast numeric to float in get_check_duration()
Browse files Browse the repository at this point in the history
Postgresql 14 changed the result type for extract() from float to
numeric.
  • Loading branch information
rudis committed Sep 2, 2023
1 parent 0bd5eae commit 8373ffa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ctf_gameserver/checker/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def get_check_duration(db_conn, service_id, std_dev_count, prohibit_changes=Fals
"""

with transaction_cursor(db_conn, prohibit_changes) as cursor:
cursor.execute('SELECT avg(extract(epoch from (placement_end - placement_start))) + %s *'
' stddev_pop(extract(epoch from (placement_end - placement_start)))'
cursor.execute('SELECT (avg(extract(epoch from (placement_end - placement_start))) + %s *'
' stddev_pop(extract(epoch from (placement_end - placement_start))))::float'
' FROM scoring_flag, scoring_gamecontrol'
' WHERE service_id = %s AND tick < current_tick', (std_dev_count, service_id))
result = cursor.fetchone()
Expand Down

0 comments on commit 8373ffa

Please sign in to comment.