Enroll Date is sometimes December 31, 1969

Re: Enroll Date is sometimes December 31, 1969

by Randy Thornton -
Number of replies: 0
Picture of Documentation writers

Right, I see similar inconsistent dating in a live site that is four years old. It is all over the map.

Looking at the code, in /completion/completion_completion.php I see logic in the function mark_enrolled() that says, if the time enrolled is NULL, set it to the current time (lines 96-107 in v. 3.1) but then when it actually saves it, is has logic that says if it is NULL then set it to 0 (lines 177 - 200). I see both of those sorts of times in my live user data.

Then in completion/cron.php it also has some complex logic for how to figure out the enrollment start time based on possible multiple enrollment plugins that may have the user start date in more than one place (lines 126-176).  But in the middle it calls mark_enrolled() without an parameter at all so that seems odd.

That code seems to be the only place it is set. It's pretty obscure to me how it works. But clearly sometimes it sets the earliest enrolment date, sometimes the current time, sometimes it sets 0.

And some methods, like Cohorts, don't put proper start times anyway. But I see widely varying data with simple manual enrollments in my data too.

Something is not right in that code, but I am not sure exactly how it does what it does.


Average of ratings: Useful (2)