Commit f65ef6d7 authored by okhin's avatar okhin 🚴

Casting to int

parent 50a0b08e
...@@ -106,7 +106,7 @@ class UserHandler ...@@ -106,7 +106,7 @@ class UserHandler
"SELECT sum(IF(quoi = 'hoopie',250,0)) + sum(IF(quoi = 'pishirt', 100, 0)) + sum(IF(quoi = 'pibag', 50, 0)) + sum(IF(quoi = 'piplome', 30, 0)) AS spent FROM contreparties WHERE user_id = :user_id", "SELECT sum(IF(quoi = 'hoopie',250,0)) + sum(IF(quoi = 'pishirt', 100, 0)) + sum(IF(quoi = 'pibag', 50, 0)) + sum(IF(quoi = 'piplome', 30, 0)) AS spent FROM contreparties WHERE user_id = :user_id",
[ 'user_id' => $user_id] [ 'user_id' => $user_id]
)->fetchColumn(); )->fetchColumn();
$this->connection->executeUpdate('UPDATE users SET total = :total, cumul = :cumul WHERE id = :user_id', ['total' => $total, 'cumul' => $total - $spent, 'user_id' => $user_id]); $this->connection->executeUpdate('UPDATE users SET total = :total, cumul = :cumul WHERE id = :user_id', ['total' => (int) $total, 'cumul' => (int) $total - (int) $spent, 'user_id' => $user_id]);
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment