MDL-86177 task: ensure tasks are runnable in indicator output.
Also fix case where task indicator progress data no longer exists, which lead to exceptions when encountered, breaking the gradebook.
This commit is contained in:
@@ -100,7 +100,6 @@ Feature: Asynchronous regrade on a large course
|
||||
Scenario: Task indicator progresses and redirects when the task is run.
|
||||
When I am on the "Test course 1" "grades > Grader report > View" page logged in as teacher1
|
||||
And I should see "The report will update automatically. You don't need to do anything."
|
||||
And I should not see "Run now"
|
||||
And I should not see "0.0%"
|
||||
And "user-grades" "table" should not exist
|
||||
And I run all adhoc tasks
|
||||
@@ -113,12 +112,6 @@ Feature: Asynchronous regrade on a large course
|
||||
And "user-grades" "table" should exist
|
||||
And "40.00" "text" should exist in the "student1@example.com" "table_row"
|
||||
|
||||
Scenario: Admin should see a "Run now" button in the task indicator
|
||||
When I am on the "Test course 1" "grades > Grader report > View" page logged in as admin
|
||||
And I should see "The report will update automatically. You don't need to do anything."
|
||||
And I should not see "0.0%"
|
||||
And I should see "Run now"
|
||||
|
||||
Scenario: Making changes on course with less than 100 grades performs the regrade synchronously, no indicator is shown.
|
||||
Given I am on the "Test assignment 2" "assign activity editing" page logged in as teacher1
|
||||
And I expand all fieldsets
|
||||
|
||||
@@ -98,6 +98,7 @@ class task_indicator implements renderable, templatable {
|
||||
if (
|
||||
array_key_exists('task', plugin_manager::instance()->get_present_plugins('tool'))
|
||||
&& is_null($this->taskrecord->timestarted)
|
||||
&& \core\task\manager::is_runnable()
|
||||
&& has_capability('moodle/site:config', system::instance())
|
||||
) {
|
||||
$this->runurl = new url('/admin/tool/task/run_adhoctasks.php', ['id' => $this->taskrecord->id]);
|
||||
@@ -124,13 +125,15 @@ class task_indicator implements renderable, templatable {
|
||||
if ($this->taskrecord) {
|
||||
$export['heading'] = $this->heading;
|
||||
$export['message'] = $this->message;
|
||||
$export['progress'] = $this->progressbar->export_for_template($output);
|
||||
$export['icon'] = $this->icon ? $this->icon->export_for_template($output) : '';
|
||||
$export['redirecturl'] = $this->redirecturl?->out();
|
||||
$export['extraclasses'] = implode(' ', $this->extraclasses);
|
||||
$export['runurl'] = $this->runurl?->out();
|
||||
$export['runlabel'] = $this->runlabel;
|
||||
$this->progressbar->init_js();
|
||||
if ($this->progressbar !== null) {
|
||||
$export['progress'] = $this->progressbar->export_for_template($output);
|
||||
$this->progressbar->init_js();
|
||||
}
|
||||
}
|
||||
return $export;
|
||||
}
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
<h2>{{heading}}</h2>
|
||||
<p>{{message}}</p>
|
||||
</div>
|
||||
{{#runurl}}
|
||||
<p class="text-center">
|
||||
<a class="runlink btn btn-primary" href="{{runurl}}" data-idnumber="{{progress.idnumber}}">{{runlabel}}</a>
|
||||
</p>
|
||||
{{/runurl}}
|
||||
{{#progress}}
|
||||
{{#runurl}}
|
||||
<p class="text-center">
|
||||
<a class="runlink btn btn-primary" href="{{runurl}}" data-idnumber="{{idnumber}}">{{runlabel}}</a>
|
||||
</p>
|
||||
{{/runurl}}
|
||||
{{>core/progress_bar}}
|
||||
{{/progress}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user