Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
don
Commits
e8f39a40
Commit
e8f39a40
authored
Oct 08, 2018
by
okhin
🚴
Browse files
We should use a sum instead of a count for counterparts.
parent
14284142
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controller/perso.php
View file @
e8f39a40
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment