Skip to content

Commit 39a8960

Browse files
committed
fix: all incorrect tick roundings
1 parent e5ee0d2 commit 39a8960

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

internal/mapdb/maps.sql.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/mapdb/queries/maps.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ where map_id = $1;
209209
with ranked_save_states as
210210
(select m.id::text as map_id,
211211
(case when ss.completed then 1 else 0 end)::int8 as completed,
212-
(round(greatest(ss.playtime, ss.ticks * 20) / 50.0) * 50)::int8 as playtime,
212+
(greatest(round(ss.playtime / 50.0), ss.ticks) * 50)::int8 as playtime,
213213
ss.updated
214214
from (select unnest($2::uuid[]) as id) m
215215
left join

internal/mapdb/queries/save_states.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ where ss.deleted is null
4343
order by case
4444
when m.leaderboard is not null
4545
and (m.leaderboard ->> 'asc')::boolean = false
46-
then -coalesce(ss.score, greatest(ss.playtime, ss.ticks * 20))
47-
else coalesce(ss.score, greatest(ss.playtime, ss.ticks * 20))
46+
then -coalesce(ss.score, greatest(ss.playtime, ss.ticks * 50))
47+
else coalesce(ss.score, greatest(ss.playtime, ss.ticks * 50))
4848
end
4949
limit 1;
5050

@@ -57,7 +57,7 @@ where deleted is null
5757
and type = 'playing'
5858
and completed = true
5959
and created > '2024-04-05T09:00:00-04:00'::timestamptz
60-
order by coalesce(score, greatest(playtime, ticks * 20))
60+
order by coalesce(score, greatest(playtime, ticks * 50))
6161
limit 1;
6262

6363
-- name: CreateSaveState :one

internal/mapdb/save_states.sql.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)