Remove course_code field from all queries using track_e_attempt - refs #7555

1.10.x
Yannick Warnier 11 years ago
parent aba01116ea
commit 36bf640aaa
  1. 4
      main/exercice/calculated_answer.class.php
  2. 2
      main/inc/lib/course.lib.php
  3. 1
      main/inc/lib/events.lib.inc.php
  4. 2
      main/inc/lib/exercise_show_functions.lib.php
  5. 11
      main/inc/lib/online.inc.php
  6. 1
      main/install/db_stats.sql

@ -260,9 +260,9 @@ class CalculatedAnswer extends Question
$table,
array(
'where' => array(
'question_id = ? AND course_code = ?' => array(
'question_id = ? AND c_id = ?' => array(
$this->id,
$this->course['code']
$this->course['real_id']
)
)
)

@ -2254,7 +2254,7 @@ class CourseManager
$sql = "DELETE FROM $table_stats_hotpots WHERE c_id = $courseId";
Database::query($sql);
$sql = "DELETE FROM $table_stats_attempt WHERE course_code = '" . $codeFiltered . "'";
$sql = "DELETE FROM $table_stats_attempt WHERE c_id = $courseId";
Database::query($sql);
$sql = "DELETE FROM $table_stats_exercises WHERE c_id = $courseId";
Database::query($sql);

@ -490,7 +490,6 @@ class Event
'question_id' => $question_id,
'answer' => $answer,
'marks' => $score,
'course_code' => $courseInfo['real_id'],
'c_id' => $course_id,
'session_id' => $session_id,
'position' => $position,

@ -210,7 +210,7 @@ class ExerciseShowFunctions
/**
* Display the answers to a multiple choice question
*
* @param int $feedback_type Feedback type
* @param integer Answer type
* @param integer Student choice
* @param string Textual answer

@ -161,7 +161,7 @@ function LoginDelete($user_id)
{
$online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$user_id = intval($user_id);
$query = "DELETE FROM ".$online_table ." WHERE login_user_id = '".$user_id."'";
$query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id";
Database::query($query);
}
@ -403,7 +403,7 @@ function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit
$number_of_items = intval($number_of_items);
$query = "SELECT login_user_id, login_date FROM $track_online_table
WHERE login_user_id <> 2 AND c_id='$courseId' AND login_date >= '$current_date'
WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date'
LIMIT $from, $number_of_items ";
$result = Database::query($query);
@ -433,12 +433,11 @@ function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null)
$online_time = time() - $time_limit * 60;
$current_date = api_get_utc_datetime($online_time);
$courseInfo = api_get_course_info($coursecode);
$courseId = api_get_course_int_id($coursecode);
$courseId = $courseInfo['real_id'];
$query = "SELECT count(login_user_id) as count
FROM ".$track_online_table ."
WHERE login_user_id <> 2 AND c_id='".$courseId."' AND login_date >= '$current_date' ";
FROM $track_online_table
WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' ";
$result = Database::query($query);
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result);

@ -209,7 +209,6 @@ CREATE TABLE track_e_online (
login_user_id int unsigned NOT NULL default 0,
login_date datetime NOT NULL default '0000-00-00 00:00:00',
user_ip varchar(39) NOT NULL default '',
course varchar(40) default NULL,
c_id int NOT NULL,
session_id INT NOT NULL DEFAULT 0,
access_url_id INT NOT NULL DEFAULT 1,

Loading…
Cancel
Save