From 0417f36d3a3b020b1a0f2b93e3c97cca0d720599 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Thu, 5 Jan 2023 12:28:41 +0300 Subject: [PATCH] i hate sql!!!! --- src/endpoints/misc/getRewards.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/endpoints/misc/getRewards.cr b/src/endpoints/misc/getRewards.cr index 8696f41..a59f254 100644 --- a/src/endpoints/misc/getRewards.cr +++ b/src/endpoints/misc/getRewards.cr @@ -35,7 +35,7 @@ def claim_chest(account_id : Int32, prev_count : Int32, large = false) timer = config_get("chests.#{large ? "large" : "small"}.timer").as?(Int64) || 0 next_at = (Time.utc + timer.seconds).to_s(Format::TIME_FORMAT) if DATABASE.scalar("select count(*) from #{table}").as(Int64) > 0 - DATABASE.exec("update #{table} set total_opened = ?, next_at = ?", prev_count + 1, next_at) + DATABASE.exec("update #{table} set total_opened = ?, next_at = ? where account_id = ?", prev_count + 1, next_at, account_id) else DATABASE.exec("insert into #{table} (account_id, total_opened, next_at) values (?, ?, ?)", account_id, prev_count + 1, next_at) end