adding ts field to reports_values table

skala
Arnaud Ligot 14 years ago
parent a4d6f28ab5
commit 3ee1914fe4
  1. 2
      main/reports/modules/course.php
  2. 2
      main/reports/modules/quiz.php
  3. 6
      main/reports/modules/scorm.php
  4. 13
      main/reports/reports.lib.php

@ -22,7 +22,7 @@ function reports_modules_course_val($course, $key_id) {
'select '.$key_id.', user_id as uid, '.
'-1 as session_id, -1 as attempt, null as score, '.
'NULL as progress, '.
'(sum(logout_course_date) - sum(login_course_date)) as time from '.
'(sum(logout_course_date) - sum(login_course_date)) as time, null as ts from '.
Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS).
' where course_code = '."'".$course['course_code']."'".
' group by user_id');

@ -27,7 +27,7 @@ function reports_modules_quiz_quizVal($quiz, $key_id) {
'select '.$key_id.', exe_user_id as uid, '.
'session_id, -1 as attempt, exe_result as score, '.
REPORTS_PROGRESS_COMPLETED.' as progress, '.
'exe_duration as time from '.
'exe_duration as time, exe_date as ts from '.
Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES).
' where exe_cours_id = '."'".$quiz['course_code']."'".
' and exe_exo_id='.$quiz['child_id']);

@ -66,7 +66,7 @@ function reports_modules_scorm_packageVal($scorm, $key_id) {
'select '.$key_id.', user_id as uid, '.
'session_id, view_count as attempt, null as score, '.
'progress as progress, '.
'null as time from '.
'null as time, null as ts from '.
Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']).
' where lp_id = '.$scorm['child_id']);
}
@ -85,7 +85,7 @@ function reports_modules_scorm_scoVal($scorm, $key_id) {
'when "not attempted" then 5 '.
'else 6 '.
'end) as progress, '.
'lpiv.total_time as time from '.
'lpiv.total_time as time, null as ts from '.
Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']).
' lpv, '.
Database::get_course_table(TABLE_LP_ITEM_VIEW, $scorm['course_db']).
@ -109,7 +109,7 @@ function reports_modules_scorm_objVal($scorm, $key_id) {
'when "not attempted" then 5 '.
'else 6 '.
'end) as progress, '.
'null as time from '.
'null as time, null as ts from '.
Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']).
' lpv, '.
Database::get_course_table(TABLE_LP_ITEM_VIEW, $scorm['course_db']).

@ -49,7 +49,8 @@ CREATE TABLE '.Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).' (
`attempt` int(11) NOT NULL,
`score` decimal(5,3) DEFAULT NULL,
`progress` int(11) DEFAULT NULL,
`time` int(11) DEFAULT NULL)');
`time` int(11) DEFAULT NULL,
`ts` datetime DEFAULT NULL)');
}
function reports_addDBKeys() {
@ -124,7 +125,7 @@ function reports_addKey($course_id, $tool_id,
// add a value
function reports_addValue($key, $session, $uid, $attempt, $score,
$progress, $time) {
$progress, $time, $ts) {
Database::query('INSERT into '.
Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
' (key_id, uid, session_id, attempt, score, '.
@ -135,7 +136,8 @@ function reports_addValue($key, $session, $uid, $attempt, $score,
($attempt == '' ? '-1' : $attempt).', '.
($score == '' ? 'NULL' : $score).', '.
($progress == '' ? 'NULL' : $progress).', '.
($time == '' ? 'NULL' : $time).')');
($time == '' ? 'NULL' : $time).', '.
($ts == '' ? 'NULL' : $ts).')');
}
// add a value using a sub query warning take care about the order of the fields
@ -143,7 +145,7 @@ function reports_addValueQuery($query) {
Database::query('INSERT into '.
Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
' (key_id, uid, session_id, attempt, score, '.
'progress, time) ('.$query.')');
'progress, time, ts) ('.$query.')');
}
// return tools ID (parametre is a constant from main_api
@ -206,7 +208,8 @@ function reports_automaticAdd($keys_query, $values_query_function) {
array_key_exists('attempt', $values['static'][$j]) ? $values['static'][$j]['attempt'] : '',
array_key_exists('score', $values['static'][$j]) ? $values['static'][$j]['score'] : '',
array_key_exists('progress', $values['static'][$j]) ? $values['static'][$j]['progress'] : '',
array_key_exists('time', $values['static'][$j]) ? $values['static'][$j]['time'] : '');
array_key_exists('time', $values['static'][$j]) ? $values['static'][$j]['time'] : '',
array_key_exists('ts', $values['static'][$j]) ? $values['static'][$j]['ts'] : '');
else
reports_addValueQuery($values['sql']);
}

Loading…
Cancel
Save