0
I’m trying to develop a ranking chart for a kind of questionnaire.
Each day a question is asked at 4pm, which can be answered until 5:59:59 the next day. The table has to show the position of the participants taking into account the number of right answers and time.
That means you answer right and faster you get first. The number of questions answered also counts, if Arque does not answer a day is penalized.
My chart will be like:
+-------+---------+---------------------+
|userid | acertou | timestamp |
+-------+---------+---------------------+
| 2 | 1 | 2018-02-07 16:00:01 |
| 1 | 1 | 2018-02-07 16:02:00 |
| 3 | 1 | 2018-02-07 17:00:00 |
| 1 | 0 | 2018-02-08 16:00:02 |
| 3 | 1 | 2018-02-08 16:00:05 |
| 2 | 0 | 2018-02-08 16:01:00 |
+-------+---------+---------------------+
I started with this query:
SELECT `userid`, `acertou`, `timestamp`,
count(acertou) as cont
FROM `resultados`
WHERE acertou = 1
GROUP BY `userid `
ORDER BY cont DESC, timestamp DESC
But I realize that this is not what I want because the ranking has to be cumulative but taking into account the various days.
Does anyone have any idea how I can do this?
makes a SUM on the score and a average calculation by the difference of time Stamp.
– Jasar Orion
Calculates the person’s 'note' in another column and makes a SUM() per user. I suggest to make a function that receives the hit and the date-time and calculate the note, so it is easier if you need to change the rule or time.
– Wilson Faustino
but I have no score, just got right or wrong question
– helderk
You want to know who hit the hardest and in less time is it ?
– rbz
right, considering it’s one question a day.
– helderk