Commit e8f39a40 authored by okhin's avatar okhin 🚴

We should use a sum instead of a count for counterparts.

parent 14284142
Pipeline #2003 passed with stages
in 10 seconds
......@@ -41,10 +41,10 @@ class Perso extends Controller
// printed piplome is 30, pibag is 50, pishirt is 100 and hoodie is 250
// We first need to have the number of each counterpart claimed by the
// user
$cumul_counterpart = $db->query("SELECT count(if(quoi='piplome', 1, 0)) as piplomes,
count(if(quoi='pibag', 1, 0)) as pibags,
count(if(quoi='pishirt', 1, 0)) as pishirts,
count(if(quoi='hoodie', 1, 0)) as hoodies
$cumul_counterpart = $db->query("SELECT sum(if(quoi='piplome', 1, 0)) as piplomes,
sum(if(quoi='pibag', 1, 0)) as pibags,
sum(if(quoi='pishirt', 1, 0)) as pishirts,
sum(if(quoi='hoodie', 1, 0)) as hoodies
FROM contreparties
WHERE user_id = '".$f3->get('SESSION.id')."';");
$cumul_counterpart = $cumul_counterpart->fetch(\PDO::FETCH_ASSOC);
......
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