Skip to content

Commit 7835ce6

Browse files
Only show standardtime checkbox for open evaluations
1 parent 818ccd0 commit 7835ce6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

block_evasys_sync.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public function get_content() {
5454
// If there has been a status in the url, show the prompt.
5555
$this->display_status($status);
5656

57+
// Get the evasys-persistenceclass for the current course if it exists.
58+
// The persistencelass only gets created when the teacher sets the evaluation period or sends an email to the coordinator.
59+
$record = course_evaluation_allocation::get_record_by_course($this->page->course->id, false);
60+
5761
// If we are not in sync mode, we display either the course mapping or the check status button.
5862
if ($evasyssynccheck !== 1) {
5963
$inlsf = !empty($this->page->course->idnumber);
@@ -79,7 +83,11 @@ public function get_content() {
7983
$this->page->requires->js_call_amd('block_evasys_sync/invite_manager', 'init');
8084
} else {
8185
$categoryhasstandardtime = \block_evasys_sync\evasys_synchronizer::get_standard_timemode($this->page->course->category);
82-
$this->page->requires->js_call_amd('block_evasys_sync/standardtime', 'init');
86+
87+
// Only use standardtime js if no record exists.
88+
if (!$record) {
89+
$this->page->requires->js_call_amd('block_evasys_sync/standardtime', 'init');
90+
}
8391
}
8492
$evasyssynchronizer = new \block_evasys_sync\evasys_synchronizer($this->page->course->id);
8593
try {
@@ -109,10 +117,6 @@ public function get_content() {
109117
$oneweeklater->add(new \DateInterval("P7D"));
110118
$end = $oneweeklater->getTimestamp();
111119

112-
// Get the evasys-persistenceclass for the current course if it exists.
113-
// The persistencelass only gets created when the teacher sets the evaluation period or sends an email to the coordinator.
114-
$record = course_evaluation_allocation::get_record_by_course($this->page->course->id, false);
115-
116120
// See if there are any students that can evaluate.
117121
// If there are no students we disable all controls.
118122
$nostudents = (count_enrolled_users(
@@ -218,7 +222,7 @@ public function get_content() {
218222
* In case of the automated workflow, we require surveys
219223
* in order to be able to automatically trigger the evaluation. */
220224
'showcontrols' => ($hassurveys || !$ismodeautomated) && count($evasyscourses) > 0 && !$invalidcourses,
221-
'usestandardtimelayout' => (!$ismodeautomated && $recordhasstandardtime),
225+
'usestandardtimelayout' => (!$ismodeautomated && $recordhasstandardtime && $record),
222226
// Choose mode.
223227
'direct' => $ismodeautomated,
224228
'startdisabled' => $startdisabled || $standardttimemode,

0 commit comments

Comments
 (0)