Commit fc3dabe7 authored by Okhin's avatar Okhin

Fixing some small typos

parent b4b8c8d5
Pipeline #2329 passed with stages
in 18 seconds
...@@ -33,10 +33,8 @@ class AddParentField extends AbstractMigration ...@@ -33,10 +33,8 @@ class AddParentField extends AbstractMigration
public function change() public function change()
{ {
$table = $this->table('contreparties'); $table = $this->table('contreparties');
if (!$table->hasColumn('parent')) { $table->addColumn('parent', 'integer');
$table->addColumn('parent', 'integer'); $table->update();
$table->update();
}
$builder = $this->getQueryBuilder(); $builder = $this->getQueryBuilder();
$stmt = $builder->update('contreparties') $stmt = $builder->update('contreparties')
->set('parent', 'id') ->set('parent', 'id')
......
...@@ -106,7 +106,7 @@ class UserHandler ...@@ -106,7 +106,7 @@ class UserHandler
// quoi = 'pibag' somme = 50 // quoi = 'pibag' somme = 50
// quoi = 'piplome' somme = 30 // quoi = 'piplome' somme = 30
$spent = $this->connection->executeQuery( $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] [ 'user_id' => $user_id]
)->fetchAll(\PDO::FETCH_COLUMN)[0]; )->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]); $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