-
Notifications
You must be signed in to change notification settings - Fork 119
/
getallsubmissions.sql
33 lines (31 loc) · 1.38 KB
/
getallsubmissions.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
SELECT
concat(quiza.uniqueid, qasd.attemptstepid, qasd.id) as uniquekey,
quiza.uniqueid as quizattemptid,
timestart,
timefinish,
u.firstname,
u.lastname,
u.email,
qatt.slot,
qatt.questionid,
quest.name as qname,
slot.maxmark as mark,
qattsteps.timecreated as timestamp,
FROM_UNIXTIME(qattsteps.timecreated,'%Y/%m/%d %H:%i:%s') as datetime,
qattsteps.fraction,
qattsteps.state,
qasd.attemptstepid,
qasd.name as qasdname,
qasd.value as value
FROM {user} u
JOIN {quiz_attempts} quiza ON quiza.userid = u.id AND quiza.quiz = :quizid
JOIN {question_attempts} qatt ON qatt.questionusageid = quiza.uniqueid
JOIN {question_attempt_steps} qattsteps ON qattsteps.questionattemptid = qatt.id
JOIN {question_attempt_step_data} qasd on qasd.attemptstepid = qattsteps.id
JOIN {question} quest ON quest.id = qatt.questionid
JOIN {quiz_slots} slot ON qatt.slot = slot.slot AND slot.quizid = quiza.quiz
WHERE quiza.preview = 0
AND (qasd.name NOT RLIKE '^-_' OR qasd.name = '-_rawfraction')
AND (qasd.name NOT RLIKE '^_' OR qasd.name = '_testoutcome')
AND quest.length > 0
ORDER BY quiza.uniqueid, timestamp;