Commit f6e1fee9 authored by okhin's avatar okhin 🚴

Merge branch '78-souci-sur-solde-des-donateurs' into 'preprod'

Fixing some small typos

Closes #78

See merge request !87
parents e4b49a4b fc3dabe7
Pipeline #2330 passed with stages
in 1 minute and 38 seconds
......@@ -33,10 +33,8 @@ class AddParentField extends AbstractMigration
public function change()
{
$table = $this->table('contreparties');
if (!$table->hasColumn('parent')) {
$table->addColumn('parent', 'integer');
$table->update();
}
$table->addColumn('parent', 'integer');
$table->update();
$builder = $this->getQueryBuilder();
$stmt = $builder->update('contreparties')
->set('parent', 'id')
......
......@@ -106,7 +106,7 @@ class UserHandler
// quoi = 'pibag' somme = 50
// quoi = 'piplome' somme = 30
$spent = $this->connection->executeQuery(
"SELECT sum(IF(quoi = 'hoodie',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 AND contreparties.id = contreparties.parent",
"SELECT sum(IF(quoi = 'hoodie',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 AND id = parent",
[ 'user_id' => $user_id]
)->fetchAll(\PDO::FETCH_COLUMN)[0];
$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