Fix error when updating exercise duration inside LP

pull/3063/head
jmontoyaa 8 years ago
parent 26a2a3cbad
commit 03e5180788
  1. 5
      main/exercise/exercise_submit.php
  2. 27
      main/inc/ajax/exercise.ajax.php

@ -1108,7 +1108,6 @@ if (!empty($error)) {
$(\'button[name="previous_question_and_save"]\').on(\'click\', function (e) {
e.preventDefault();
e.stopPropagation();
var
$this = $(this),
previousId = parseInt($this.data(\'prev\')) || 0,
@ -1120,9 +1119,7 @@ if (!empty($error)) {
$(\'button[name="save_question_list"]\').on(\'click\', function (e) {
e.preventDefault();
e.stopPropagation();
var
$this = $(this),
var $this = $(this),
questionList = $this.data(\'list\').split(",");
save_question_list(questionList);

@ -7,7 +7,7 @@ use ChamiloSession as Session;
* Responses to AJAX calls.
*/
require_once __DIR__.'/../global.inc.php';
$debug = false;
api_protect_course_script(true);
$action = $_REQUEST['a'];
@ -24,9 +24,32 @@ switch ($action) {
case 'update_duration':
$debug = true;
$exeId = isset($_REQUEST['exe_id']) ? $_REQUEST['exe_id'] : 0;
if (Session::read('login_as')) {
if ($debug) {
error_log("User is 'login as' don't update duration time.");
}
exit;
}
if (empty($exeId)) {
if ($debug) {
error_log("Exe id not provided.");
}
exit;
}
/** @var Exercise $exerciseInSession */
$exerciseInSession = Session::read('objExercise');
if (!empty($exeId) && !empty($exerciseInSession)) {
if (empty($exerciseInSession)) {
if ($debug) {
error_log("Exercise obj not provided.");
}
exit;
}
if (!empty($exerciseInSession)) {
$em = Database::getManager();
/** @var \Chamilo\CoreBundle\Entity\TrackEExercises $attempt */
$attempt = $em->getRepository('ChamiloCoreBundle:TrackEExercises')->find($exeId);

Loading…
Cancel
Save