Fixed events-related functions and tests

skala
ywarnier 14 years ago
parent 79f024086f
commit 732ffe8534
  1. 7
      main/inc/lib/events.lib.inc.php
  2. 3
      tests/main/admin/calendar.lib.test.php

@ -312,7 +312,8 @@ function event_link($link_id) {
* @desc Record result of user when an exercice was done
*/
function update_event_exercice($exeid, $exo_id, $score, $weighting,$session_id,$learnpath_id=0, $learnpath_item_id=0, $learnpath_item_view_id = 0, $duration) {
if ($exeid!='') {
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
if ($exeid!='') {
// Validation in case of fraud with actived control time
if (!exercise_time_control_is_valid($exo_id)) {
$score = 0;
@ -417,6 +418,7 @@ function create_event_exercice($exo_id) {
*/
function exercise_attempt($score, $answer, $quesId, $exeId, $j, $exercise_id = 0) {
global $_configuration;
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
$score = Database::escape_string($score);
$answer = Database::escape_string($answer);
$quesId = Database::escape_string($quesId);
@ -453,7 +455,7 @@ function exercise_attempt($score, $answer, $quesId, $exeId, $j, $exercise_id = 0
'".$j."',
'".$reallyNow."'
)";
error_log($sql);
//error_log($sql);
if (!empty($quesId) && !empty($exeId) && !empty($user_id)) {
$res = Database::query($sql);
if (defined('ENABLED_LIVE_EXERCISE_TRACKING')){
@ -478,6 +480,7 @@ function exercise_attempt($score, $answer, $quesId, $exeId, $j, $exercise_id = 0
* @uses Course code and user_id from global scope $_cid and $_user
*/
function exercise_attempt_hotspot($exe_id, $question_id, $answer_id, $correct, $coords, $exerciseId = 0) {
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.lib.php';
//Validation in case of fraud with actived control time
if (!exercise_time_control_is_valid($exerciseId)) {
$correct = 0;

@ -38,7 +38,8 @@ class TestCalendar extends UnitTestCase {
$db_start_date='07/11/2009';
$db_end_date='07/20/2009';
$res = agenda_add_item($course_info, $title, $content, $db_start_date, $db_end_date, $to=array(), $parent_id=null);
$this->assertTrue(is_numeric($res));
$this->assertTrue($res>0,'Global agenda item could not be inserted');
delete_agenda_item($res);
//var_dump($res);
}

Loading…
Cancel
Save