Issue #73 - Could not reproduce the issue but this fix should work.

- Added a fixed timestamp to get both planned/past outages, unlikely to happen outsite debugging environment but it could have a timing problem when fetching each list of outages.

- Changed the query to get ended queries to be a the conditions of NOT a past outage. I believe the old query was equivalent but that should rule out a query problem.
This commit is contained in:
Daniel Thee Roperto
2016-11-08 11:56:11 +11:00
parent 54c43d2508
commit deb6d87e72
2 changed files with 6 additions and 3 deletions

View File

@@ -256,7 +256,7 @@ class outagedb {
$rs = $DB->get_recordset_select(
'auth_outage',
':datetime1 >= stoptime OR (finished IS NOT NULL AND :datetime2 >= finished)',
'NOT (:datetime1 < stoptime AND (finished IS NULL OR :datetime2 < finished))',
['datetime1' => $time, 'datetime2' => $time],
'stoptime DESC, starttime DESC, title ASC',
'*');

View File

@@ -34,9 +34,12 @@ $PAGE->set_url(new moodle_url('/auth/outage/manage.php'));
echo $OUTPUT->header();
// Give it a consistent time so all outages are listed. Useful when debugging.
$now = time();
renderer::get()->output_view('manage.php', [
'unended' => outagedb::get_all_unended(),
'ended' => outagedb::get_all_ended(),
'unended' => outagedb::get_all_unended($now),
'ended' => outagedb::get_all_ended($now),
]);
echo $OUTPUT->footer();