Skip to content

Commit

Permalink
ELIS-8532: Fixed errors preventing scheduled report jobs from completing
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcq authored and Akinsaya Delamarre committed Aug 16, 2013
1 parent ef77bd4 commit 9e558ab
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 27 deletions.
26 changes: 12 additions & 14 deletions js/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,22 @@ function php_report_schedule_run_jobs(wwwroot, scheduleids, schedulenames, index
// success handler
var php_report_success = function(o) {
// parse the reponse data, consisting of progress text and an error message
var response_data;
YUI().use('yui2-json', function(Y) {
var YAHOO = Y.YUI2;
response_data = YAHOO.lang.JSON.parse(o.responseText);
});
var responsedata = YAHOO.lang.JSON.parse(o.responseText);
php_report_schedule_update_progress_bar(index + 1, scheduleids.length);

php_report_schedule_update_progress_bar(index + 1, scheduleids.length);
if ((index + 1) < scheduleids.length) {
// chain on to the next job
php_report_schedule_run_jobs(wwwroot, scheduleids, schedulenames, index + 1, runninglabel, donerunninglabel, responsedata[0]);
} else {
php_report_schedule_set_current_job(donerunninglabel);
php_report_schedule_set_progress(responsedata[0]);

if ((index + 1) < scheduleids.length) {
// chain on to the next job
php_report_schedule_run_jobs(wwwroot, scheduleids, schedulenames, index + 1, runninglabel, donerunninglabel, response_data[0]);
} else {
php_report_schedule_set_current_job(donerunninglabel);
php_report_schedule_set_progress(response_data[0]);

// update errors in the UI
php_report_schedule_append_error(response_data[1]);
}
// update errors in the UI
php_report_schedule_append_error(responsedata[1]);
}
});
}

// failure handler
Expand Down
1 change: 1 addition & 0 deletions lib/run_schedule_async.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
}

//spit out information regarding the current position
$a = new stdClass;
$a->current = $current;
$a->total = $total;

Expand Down
9 changes: 2 additions & 7 deletions lib/run_schedule_popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
}
}

//calculate the labels to display
// Calculate the labels to display.
$runninglabel = get_string('popup_running_label', 'block_php_report');
$donerunninglabel = get_string('popup_done_running_label', 'block_php_report');

Expand All @@ -115,12 +115,7 @@
$runninglabel,
$donerunninglabel,
$progress_text);
$PAGE->requires->js_function_call('php_report_schedule_run_jobs', $params, true, array(
'yui2-connection',
'yui2-dom',
'yui2-event',
'yui2-json'
));
$PAGE->requires->js_function_call('php_report_schedule_run_jobs', $params, true, 0);

//temporarily change the config global to prevent the documentation link
//from showing up
Expand Down
6 changes: 1 addition & 5 deletions lib/schedulelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -801,11 +801,7 @@ function display_runjobs() {
'options' => "\"menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\"");
$params = array(null, $js_params);
// include the necessary javascript libraries for the ASYNC request stuff
$PAGE->requires->js_function_call('openpopup', $params, true, array(
'yui2-connection',
'yui2-dom',
'yui2-event'
));
$PAGE->requires->js_function_call('openpopup', $params, true, 0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion runschedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function php_report_schedule_export_instance($report_schedule, $now = 0) {
global $CFG;

if ($now == 0) {
$now = gmmktime(); // time();
$now = time();
}

$data = unserialize($report_schedule->config);
Expand Down

0 comments on commit 9e558ab

Please sign in to comment.