Hi!
So I'm keeping track of on how "hard" questions are in a quiz application I have. But I would like to display a progress bar for admins to they can see if a question is overrepresented in some way.
So this thread is for two problems. First group "correct" and "wrong" for all questions in a specific quiz group. And then for a specific question. Hope this makes sense =)
The database looks like this:
id user_id stack_id question_id answer created_at updated_at
1 1 1 3 wrong 2017-09-28 20:51:39 2017-09-28 20:51:39
2 1 1 4 correct 2017-09-28 20:52:18 2017-09-28 20:52:18
3 1 1 5 wrong 2017-09-28 20:54:24 2017-09-28 20:54:24
4 1 1 1 wrong 2017-09-28 21:05:49 2017-09-28 21:05:49
5 1 1 1 correct 2017-09-28 21:07:41 2017-09-28 21:07:41
6 1 1 3 correct 2017-09-28 21:07:46 2017-09-28 21:07:46
7 1 1 4 correct 2017-09-28 21:07:50 2017-09-28 21:07:50
8 1 1 1 wrong 2017-09-28 21:09:32 2017-09-28 21:09:32
9 1 1 3 wrong 2017-09-28 21:09:35 2017-09-28 21:09:35
So for the first problem. I think grabbing all answers with stack_id, then maybe group by correct/wrong? And display the result on a progress bar?
<progress class="progress is-success is-small" value="#" max="#"></progress>
The second problem is for a specific question. Maybe do the same but with question_id?
Doing this will improve for admins and moderators to follow what questions and what "group" of questions that seems to be problematic for the students.
Hope this makes sense, I have not been able to solve it myself!
I have got things working with ordinary SQL, but cannot figure out on how to implement it
Example:
SELECT COUNT(*), answer FROM
`answers`
where `stack_id` = 1
GROUP BY answer