alfa24 wrote: ↑Sun Mar 07, 2021 2:49 pm
You must be missing something. I've tried and it works.
Unfortunately not. There is still the current time value being assigned to the learning_coursesuer:date_completed field in the database. competencies will make no difference to this, as it's the subscribe library that is controlling the date insertion, alongside the lib.date.php file with setDateFinished().
Has this been fixed in the latest code release? Of is this debugging old code? I'm running 2.3.
public function setDateFinished($id_date, $id_user)
{
list($last_datetime) = sql_fetch_row(sql_query("SELECT MAX(day) AS date_end "
." FROM ".$this->presence_date_table." WHERE id_date = ".$id_date." and id_user = ".$id_user
." GROUP BY id_date"));
list($id_course) = sql_fetch_row(sql_query("SELECT id_course FROM ".$this->date_table." WHERE id_date = ".$id_date));
sql_query("UPDATE ".$this->courseuser_table." SET date_complete = '".($last_datetime?$last_datetime:date('Y-m-d H:i:s'))."' WHERE idUser = ".$id_user." AND idCourse = ".$id_course);
$query = "UPDATE ".$this->user_date_table
." SET date_complete = '".($last_datetime?$last_datetime:date('Y-m-d H:i:s'))."'"
." WHERE id_date = ".$id_date
." AND id_user = ".$id_user;
if (sql_query($query))
return $last_datetime;
else return false;
}
In /appLms/admin/models/SubscriptionAlms.php, find:
To be honest, I find the whole workflow very chaotic and redundant so I've spent a couple of weeks working at its refactoring. Now my instance is much more logical regarding status changes, and what happens when the status changes to completed.
Not only comptenences are involved, but also certificates, meta certificates, coursepaths, subscription policies and so on.
The best way is to hook with the courseuser event. With the occasion, I suggest to upgrade synfony framework to make it work wit PHP 8 and enjoy its powerful components.
alfa24 wrote: ↑Sat Mar 20, 2021 7:27 pm
To be honest, I find the whole workflow very chaotic and redundant so I've spent a couple of weeks working at its refactoring. Now my instance is much more logical regarding status changes, and what happens when the status changes to completed.
Not only competences are involved, but also certificates, meta certificates, coursepaths, subscription policies and so on.
The best way is to hook with the courseuser event. With the occasion, I suggest to upgrade synfony framework to make it work wit PHP 8 and enjoy its powerful components.
I agree alfa24, I'm currently looking to Laravel as a framework to rebuild the system around, or refactor all the existing code in some form or another. The implementations you have shown above are great, but if you do not carry out actions in a certain way (mark attendance, then set course to Complete) the system does not update the DB field. This isn't a coding fault per se, just how the framework works.
The Laravel route is long and tiring, but I think will produce a new system that has many of the features but if more maintainable than the current system.