From b9e731d7150e17ee9fe5b034e9bd0ca91a6ef3cb Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 15 Jul 2020 09:14:30 +0200 Subject: [PATCH] Student assignment fix add virtual time in new system BT#17516 Save work id instead of result id --- main/inc/lib/events.lib.php | 10 +++++----- main/mySpace/myStudents.php | 1 - main/work/work.lib.php | 8 +++++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/main/inc/lib/events.lib.php b/main/inc/lib/events.lib.php index 0760840bc8..1bc380ec05 100644 --- a/main/inc/lib/events.lib.php +++ b/main/inc/lib/events.lib.php @@ -2242,7 +2242,7 @@ class Event * @param int $sessionId The session in which to add the time (if any) * @param string $virtualTime The amount of time to be added, * in a hh:mm:ss format. If int, we consider it is expressed in hours. - * @param int $resultWorkId Student publication id result + * @param int $workId Student publication id result * * @return true on successful insertion, false otherwise */ @@ -2251,7 +2251,7 @@ class Event $userId, $sessionId, $virtualTime, - $resultWorkId + $workId ) { if (empty($virtualTime)) { return false; @@ -2293,14 +2293,14 @@ class Event Database::insert($platformTrackingTable, $params); if (Tracking::minimumTimeAvailable($sessionId, $courseId)) { - $resultWorkId = (int) $resultWorkId; + $workId = (int) $workId; $logInfo = [ 'c_id' => $courseId, 'session_id' => $sessionId, 'tool' => TOOL_STUDENTPUBLICATION, 'date_reg' => $loginDate, - 'action' => 'add_work_start_'.$resultWorkId, + 'action' => 'add_work_start_'.$workId, 'action_details' => $virtualTime, 'user_id' => $userId, ]; @@ -2311,7 +2311,7 @@ class Event 'session_id' => $sessionId, 'tool' => TOOL_STUDENTPUBLICATION, 'date_reg' => $logoutDate, - 'action' => 'add_work_end_'.$resultWorkId, + 'action' => 'add_work_end_'.$workId, 'action_details' => $virtualTime, 'user_id' => $userId, ]; diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 41818b54ab..ca560a853c 100755 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -1901,7 +1901,6 @@ if (empty($details)) { true ); - foreach ($resultExtra as $field) { $field = $field['value']; if ($workingTime == $field->getField()->getVariable()) { diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 1485b6745d..2cff3b5ab3 100755 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -4300,7 +4300,13 @@ function processWorkForm( if (1 == count($userWorks)) { // The student only uploaded one doc so far, so add the // considered work time to his course connection time - Event::eventAddVirtualCourseTime($courseId, $userId, $sessionId, $workingTime, $workId); + Event::eventAddVirtualCourseTime( + $courseId, + $userId, + $sessionId, + $workingTime, + $workInfo['iid'] + ); } } }