Saving duration in seconds and showing in minutes see BT#4488

skala
Julio Montoya 14 years ago
parent 48aeaa6b55
commit 4a83a66e41
  1. 4
      main/exercice/exercise.lib.php
  2. 2
      main/exercice/exercise_report.php
  3. 3
      main/exercice/exercise_submit.php
  4. 23
      main/inc/ajax/exercise.ajax.php
  5. 4
      main/inc/lib/events.lib.inc.php

@ -1067,7 +1067,9 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
$group_name_list .= $group_list_info[$id]['name'].' ';
}
$results[$i]['group_name'] = $group_name_list;
}
}
$results[$i]['exe_duration'] = !empty($results[$i]['exe_duration']) ? round($results[$i]['exe_duration'] / 60) : 0;
$user_list_id[] = $results[$i]['exe_user_id'];
$id = $results[$i]['exe_id'];

@ -331,7 +331,7 @@ if ($is_allowedToEdit || $is_tutor) {
//The order is important you need to check the the $column variable in the model.ajax.php file
$columns = array(get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'),
get_lang('Group'), get_lang('Duration'), get_lang('StartDate'), get_lang('EndDate'), get_lang('Score'), get_lang('Status'), get_lang('Actions'));
get_lang('Group'), get_lang('Duration').' ('.get_lang('MinMinute').')', get_lang('StartDate'), get_lang('EndDate'), get_lang('Score'), get_lang('Status'), get_lang('Actions'));
//Column config
$column_model = array(

@ -151,10 +151,9 @@ if ($objExercise->expired_time != 0 && $origin != 'learnpath') {
$time_control = true;
}
//Generating the time control key for the user
$current_expired_time_key = generate_time_control_key($objExercise->id);
$_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp;
$_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp;
if ($time_control) {
//Get the expired time of the current exercice in track_e_exercices

@ -316,24 +316,25 @@ switch ($action) {
$duration = 0;
$now = time();
if ($type == 'all') {
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
}
if (isset($_SESSION['duration_time'][$key]) && !empty($_SESSION['duration_time'][$key])) {
$duration = $now - $_SESSION['duration_time'][$key];
if (!empty($exercise_stat_info['exe_duration'])) {
$duration += $exercise_stat_info['exe_duration']*60;
$duration += $exercise_stat_info['exe_duration'];
}
$duration = intval(round($duration/60));
$_SESSION['duration_time'][$key] = 0;
} else {
$duration = intval($duration);
} else {
if (!empty($exercise_stat_info['exe_duration'])) {
$duration = $exercise_stat_info['exe_duration'];
}
if ($type == 'all') {
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
$duration = $exercise_stat_info['exe_duration'];
}
}
}
$_SESSION['duration_time'][$key] = time();
update_event_exercice($exe_id, $objExercise->selectId(), $total_score, $total_weight, api_get_session_id(), $exercise_stat_info['orig_lp_id'], $exercise_stat_info['orig_lp_item_id'], $exercise_stat_info['orig_lp_item_view_id'], $duration, $question_list, 'incomplete', $remind_list);
// Destruction of the Question object

@ -311,7 +311,7 @@ function event_link($link_id) {
* @param int exo_id exercise id
* @param mixed result score
* @param int weighting ( higher score )
* @param int duration ( duration of the attempt, in seconds )
* @param int duration ( duration of the attempt in seconds )
* @param int session_id
* @param int learnpath_id (id of the learnpath)
* @param int learnpath_item_id (id of the learnpath_item)
@ -322,7 +322,7 @@ function event_link($link_id) {
*/
function update_event_exercice($exeid, $exo_id, $score, $weighting, $session_id, $learnpath_id = 0, $learnpath_item_id = 0, $learnpath_item_view_id = 0, $duration = 0, $question_list = array(), $status = '', $remind_list = array() , $end_date = null) {
//error_log('Called to update_event_exercice');
//error_log('duration:' . $duration);
error_log('duration:' . $duration);
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
if ($exeid != '') {
// Validation in case of fraud with actived control time

Loading…
Cancel
Save