showing hp results in assessments -refs #5994

1.9.x
unknown 13 years ago
parent 5794a2d552
commit 0dc1fd6751
  1. 43
      main/gradebook/lib/be/exerciselink.class.php
  2. 2
      main/gradebook/lib/flatview_data_generator.class.php

@ -154,24 +154,37 @@ class ExerciseLink extends AbstractLink
* or null if no scores available
*/
public function calc_score($stud_id = null) {
$tbl_stats = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tblStats = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tblHp = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$tblDoc = Database::get_course_table(TABLE_DOCUMENT);
//$tbl_stats_e_attempt_recording = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
//the following query should be similar (in conditions) to the one used in exercice/exercice.php, look for note-query-exe-results marker
$session_id = api_get_session_id();
$sql = "SELECT * FROM $tbl_stats
WHERE exe_exo_id = ".intval($this->get_ref_id())." AND
orig_lp_id = 0 AND
orig_lp_item_id = 0 AND
status <> 'incomplete' AND
session_id = $session_id
";
if (isset($stud_id)) {
$course_code_exe = $this->get_course_code();
$sql .= " AND exe_cours_id = '$course_code_exe' AND
exe_user_id = '$stud_id' ";
}
$sql .= ' ORDER BY exe_id DESC';
if (!$this->is_hp) {
$sql = "SELECT * FROM $tblStats
WHERE exe_exo_id = ".intval($this->get_ref_id())." AND
orig_lp_id = 0 AND
orig_lp_item_id = 0 AND
status <> 'incomplete' AND
session_id = $session_id
";
if (isset($stud_id)) {
$course_code_exe = $this->get_course_code();
$sql .= " AND exe_cours_id = '$course_code_exe' AND
exe_user_id = '$stud_id' ";
}
$sql .= ' ORDER BY exe_id DESC';
} else {
$course_code_exe = $this->get_course_code();
$sql = "SELECT * FROM $tblHp hp, $tblDoc doc
WHERE hp.exe_cours_id = '$course_code_exe' AND
hp.exe_user_id = '$stud_id' AND hp.exe_name = doc.path AND doc.id = ".intval($this->get_ref_id())."
";
}
$scores = Database::query($sql);
if (isset($stud_id)) {

@ -395,7 +395,7 @@ class FlatViewDataGenerator
if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) {
if (!$show_all) {
if (in_array($item->get_type() , array(LINK_EXERCISE, LINK_DROPBOX, LINK_STUDENTPUBLICATION,
LINK_LEARNPATH, LINK_FORUM_THREAD, LINK_ATTENDANCE,LINK_SURVEY))) {
LINK_LEARNPATH, LINK_FORUM_THREAD, LINK_ATTENDANCE, LINK_SURVEY, LINK_HOTPOTATOES))) {
if (!empty($score[0])) {
$row[] = $temp_score.' ';
} else {

Loading…
Cancel
Save