i have to get the status of completion of the scrom package by students and i wrote a code that is displaying only the completed and incomplete students data, but i also want those students who are enrolled but not attempted the thing, help me.
This is my query:
select u.id as userid,u.firstname as firstname,u.lastname as lastname,c.fullname as coursename,s.name as scormname,sst.attempt as attempt,sst.value as status,
CASE
when s.timeopen=0 then 'not enabled'
when s.timeopen<>0 then from_unixtime(s.timeopen,'%d-%b-%Y')
end
as starttime,
CASE
when s.timeclose=0 then 'not enabled'
when s.timeclose<>0 then from_unixtime(s.timeclose,'%d-%b-%Y')
end
as enddate
from mdl_scorm_scoes_track sst
join mdl_scorm s on s.id=sst.scormid
join mdl_course c on c.id=s.course
join mdl_user u on sst.userid=u.id
where sst.value in ('incomplete','completed')
–give me some code that will be helpful
2
Answers
If I understand correctly, I think you need
Left Join
and starting from the user tableThe activity completion is in a table called
mdl_course_modules_completion
This SQL narrows the completion down to scorm activities
Also a check to see if a user is enrolled in any way – note that a user can be enrolled more than once on a course