Certificate: required minutes in course

Certificate: required minutes in course

i le Andrea C. -
Number of replies: 9

Goodo morning all,

from what I can understand from testing in Moodle 2.8, the "required minutes in course" condition checks the first moment when user enters in the course page, and then measures the elapsed time, till the criteria is satisfied, even if user logout in the meanwhile. In fact, certificate is not measuring effective time spent in pages of the course, but just the elapsed from first access.

That behavior is a relevant issue, because a recent national law in Italy requires to elearning providers to certify effective time spent from users in online course: if a course is certified for 6 hours, logs should demonstrate that user effectively spent 6 hours in the LMS; and the final certificate, after SCORM, after quiz, should be released only after 6 hours of effective activity.

I know that "time spent" is not necessarily quality of study, but the law is now requiring measurement as a mandatory condition.

I can imagine that measuring time spent is not so easy (counting logs inside the course, checking logout, etc), but from what I can see with the Timestat module, is possible. Certificates should be accessed only after "effective" time spent in course, and student and administrator should know how much time has been spent.

If anyone has some idea on how to solve the problem, do not hesitate to contact me. Since is a strong law and business requirement, if needed, my company could support developments with donations or direct funding, according to Moodle policy.

Thank you
Andrea

Average of ratings: -
In reply to Andrea C.

Re: Certificate: required minutes in course

i le Jean-Michel Védrine -

Hello Andrea,

Unfortunately things are a lot more complex fa'anoanoa

First your assumption that most user sessions are terminated by a logout is wrong, most user just close their browser, navigate to another website or shut down their computer so in most case no information is send to the server when they leave the course.

It's a matter of fact that due to the Internet's nature, we can only retrieve people "actions" from the log and leaving the course is not an action we can easily.

It's also a matter of fact that in most countries (my country France is no exception ata ) people that make the law don't understand anything to computing, online learning, and all modern technology so they edict stupid requirements that nobody can met fa'aivi-le-mata

Your assumption at how the certificate code is measuring the time in course is wrong, the code is in localib.php in the certificate_get_course_time function

- the first action found in the logs is considered as the time where the user entered the course

- then all actions are examined in chronological order and if the time between 2 actions is greater than $CFG->sessiontimeout * 60 seconds, the code assume that the user have been disconected and the next action is the start of a new session

Surely this is not perfect, but in most case it should give a good mesurement of the time spent by the student in the course.

Of course it could be improved, for instance we could introduce a new setting and consider that setting as a max allowed inactivity time and say that if 2 actions are separated by a time greater than that, then session has been terminated, but I am not sure this would be a good move because it would be difficult for the administrator to adjust this setting value, surely for instance if there is a complicated assignment, student will spend a good amount of time before sending their answer to the server and this could be considered as a disconnection.

The only bulletproof method to verify that the student's computer is still connected to the course would be that the server periodically ping it to ensure it is still here. But that would increase needed bandwidth a lot for course with a lot of students connected at the same time  and you will increase chance of  a server overload, and if you think it would not prove that the student is effectively in front of his computer and learning (he could be away or even in from of his computer and doing some more fun activity in another window fa'aivi-le-mata )

So we can clearly see this is a very stupid law.

In reply to Jean-Michel Védrine

Re: Certificate: required minutes in course

i le Andrea C. -
Bonjour Jean-Michel,

thank you for your feedback and explanations.

Your clarification about the logic explained me why, after my tests, I assumed that certificate was measuring only elapsed. In fact controls are made on course's logs; so if I login, go to course, logout, login, go to course ... if the elapsed between two "go to course" is below timeout (default 2h in my case), certificate add this time to global counter. May be is improvable, but is not strictly essential at that stage.

About the law, I agree that has not been written by IT people, but is law, and has to be respected from professional companies providing online courses. From my point of view, in order to make Moodle fully compliant to the law, my proposal to you and to the community is to consider to develop, even through donation or funding if needed, these two points:

1) would it be possible to add to the error message of certificate (You must spend at least a minimum of ...) the elapsed time considered by certificate, in order to make students aware of ? From language pack I can see currently is used "$a->requiredtime". May be we can easily add elapsed time (formatted in hours and minutes could be even more readable)

2) would it be possible to create for administrator a report (a csv usable with xls, for example) indicating, for each course's student, a) first access recorded by certificate b) elapsed time (as per certificate) c) last log recorded by certificate d) number of days with recorded activity (law is requiring total number of login, but I suppose this is not recorded at certificate/course's level)

Many thanks in advance for your advice.
Do not hesitate to contact me for further details.

Best regards
Andrea
In reply to Andrea C.

Re: Certificate: required minutes in course

i le Jean-Michel Védrine -

1) is easy to do

in mod/certificate/view.php replace the code

// Check if the user can view the certificate
if ($certificate->requiredtime && !has_capability('mod/certificate:manage', $context)) {
    if (certificate_get_course_time($course->id) < ($certificate->requiredtime * 60)) {
        $a = new stdClass;
        $a->requiredtime = $certificate->requiredtime;
        notice(get_string('requiredtimenotmet', 'certificate', $a), "$CFG->wwwroot/course/view.php?id=$course->id");
        die;
    }
}

with

// Check if the user can view the certificate
if ($certificate->requiredtime && !has_capability('mod/certificate:manage', $context)) {
    $timespent = certificate_get_course_time($course->id);
    if ($timespent < ($certificate->requiredtime * 60)) {
        $a = new stdClass;
        $a->requiredtime = format_time($certificate->requiredtime * 60);
        $a->timespent = format_time($timespent);
        notice(get_string('requiredtimenotmet', 'certificate', $a), "$CFG->wwwroot/course/view.php?id=$course->id");
        die;
    }
}

And in the language file mod/certificate/lang/en/certificate.php change the string for something like

$string['requiredtimenotmet'] = 'You must spend at least a minimum of {$a->requiredtime} in the course before you can access this certificate and you have only spent {$a->timespent} so far.';

Unfortunately 2) would need some programmer to do the job, and I currently don't have much time available for Moodle programming (don't forget I'm a teacher !) but it seems quite doable.

Maybe you should also investigate if some custiom sql query would give you all the informations you need, if I were you, and if you have some sql knowledge I would look at the https://moodle.org/plugins/view/report_customsql plugin to see if it could do the job.


In reply to Jean-Michel Védrine

Re: Certificate: required minutes in course

i le Jean-Michel Védrine -

While thinking about this issue, I discovered something: a certificate activity can be made dependant of some other activities with completion conditions but it is not easy to have an activity dependant of the fact an user received a certificate because the only completion rule certificate support is "activity viewed and this condition is satisfied as soon as the user try to view the certificate even if the time spent condition is not satisfied.

Has anybody found a workaround ?

In reply to Jean-Michel Védrine

Re: Certificate: required minutes in course

i le Jean-Michel Védrine -

I think an elegant solution to this problem could be to move the requiredtime to be a custom completion rule (and also to change it to be a duration in seconds so that we can use the duration form element and format_time function). Doing that, it would be possible to have a certificate activity marked as complete only if student spend a given amount of time in course and give conditional access to other activity on certificate completion.

It should not be difficult to do. Maybe as I am on holidays, I will give it a try and submit the modification to Mark.

In reply to Jean-Michel Védrine

Re: Certificate: required minutes in course

i le Jean-Michel Védrine -

Well as usual when I find something interesting, I could not go to bed without trying it ata.

So I did a branch with a custom completion rule "time spent in course" https://github.com/jmvedrine/moodle-mod_certificate/tree/completion_timespent

And I submitted a tracker issue to see if Mark is interested with this change: CONTRIB-5693

Warning: you can test this a a test server, but don't try it now on a production server because this change convert all certificates required times from minutes to seconds so if you try it on a production server it will render your certificate data incompatible with the certificate module without this change. Better to wait for Mark comments and see if he want to change that also in the certificate module.

In reply to Jean-Michel Védrine

Re: Certificate: required minutes in course

i le Andrea C. -

Jean Michel ... wow !


Really really thank you !

What you're doing sounds so interesting and perfectly fitting to that need !

And seems a very promising update of functions ...


Just let put together all the pieces of what you did with Mark's feedback ... and I think we're really close to a very clever and useful function !


Let's update soon !

Have a nice day

Andrea

In reply to Jean-Michel Védrine

Re: Certificate: required minutes in course

i le Andrea C. -
Hi Jean Michel,

we applied 2 modifications to code and they work great: now we can give to users the amount of time spent on courses vs target time !

Doing some tests, I found again the first issue, where I'm not sure if I'm correctly understanding how the "cut" on timespent is linked to timeout. From the test I did, it seems that certificate could be realeased even if there is a timeout inbetween.

Here you can see the test I did:
http://www-test.progetica.org/andrea/test.pdf

Many thanks for your support
Andrea
In reply to Andrea C.

Re: Certificate: required minutes in course (CPD requirement)

i le Graham Moir -


This is an interesting question that I've been looking into as well.  I came across the "Attendance Register" plugin which supposedly does the tracking of time in a course for you, although it uses legacy logs and was last supported properly on Moodle 2.6, so using it could be risky.  Can anyone explain what the difference between "certificate: required minutes in course" and the functionality of "attendance register" is?

Also, just for my edification, are the changes mentioned in this thread formally in Moodle 2.9 ?

Thanks