I am working on a time based quiz project with PHP and MySQL and storing results as in below table.
Table: score
sid |Question_ID|answer |is_correct|User_ID|score|score_calculated|time_taken
1 |10 |Manager|Y | 1 |200 | 0 |3.2
2 |10 |Emp |N | 2 |200 | 0 |2.4
3 |10 |Manager|Y | 3 |200 | 0 |6.5
4 |10 |Other |N | 4 |200 | 0 |8.3
5 |11 |Yellow |N | 1 |300 | 0 |2.3
5 |11 |green |N | 2 |300 | 0 |5.8
6 |11 |Red |Y | 3 |300 | 0 |6.4
7 |11 |Red |Y | 4 |300 | 0 |9.1
Score column contain the mark for each question
Score calculations based on:
- Correct answer used minimum time = 100%
- Correct answer used 2nd minimum time = 75%
- Correct answer used 3rd minimum time = 50%
- Other correct answers = 25%
- Other incorrect answers = 0
The above calculated values need to be updated on ** 'score_calculated' ** field. Can anyone please suggest a query or method to solve the scoring process?