Student assignment fix add virtual time in new system BT#17516

Save work id instead of result id
pull/3376/head
Julio Montoya 6 years ago
parent 9e05d2fd77
commit b9e731d715
  1. 10
      main/inc/lib/events.lib.php
  2. 1
      main/mySpace/myStudents.php
  3. 8
      main/work/work.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,
];

@ -1901,7 +1901,6 @@ if (empty($details)) {
true
);
foreach ($resultExtra as $field) {
$field = $field['value'];
if ($workingTime == $field->getField()->getVariable()) {

@ -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']
);
}
}
}

Loading…
Cancel
Save