我正在使用Moodle LMS,我需要运行一份报告,了解学生提交任何人类可分级作业的时间与评分时间之间需要多长时间才能监控员工的工作效率。现在我要进行类似下面的查询。我仍然需要添加实际的作业,但我不确定moodle中的哪些项目可能适合“已提交但等待评分”的类别。
我在这个查询中缺少哪些表格,有什么我在这里显然做错了吗?
SELECT c.shortname AS course_name
, cm.id AS cmid
, cm.course AS courseid
, md.name AS modname
, gi.itemname AS itemname
, u.firstname AS student_first
, u.lastname AS student_last
, f.firstname AS grader_first
, f.lastname AS grader_last
, NULLIF(GREATEST(IFNULL(g.overridden, 0)
,IFNULL(g.timecreated, 0)
,IFNULL(g.timemodified, 0))
,0) AS graded_unixtimestamp
FROM mdl_user u
JOIN mdl_user_enrolments ue
ON (u.id = ue.userid)
JOIN mdl_enrol e
ON (e.id = ue.enrolid)
JOIN mdl_course c
ON (c.id = e.courseid)
JOIN mdl_course_modules cm
ON (c.id = cm.course)
JOIN mdl_modules md
ON (md.id = cm.module)
JOIN mdl_grade_items gi
ON (
gi.itemmodule = md.name
AND gi.iteminstance = cm.instance
AND gi.courseid = cm.course)
LEFT
JOIN mdl_grade_grades g
ON (gi.id = g.itemid AND g.userid = u.id)
LEFT
JOIN mdl_user f
ON (g.usermodified = u.id);