MDL-30271 Inform the user about the example assessment conflict, instead of throwing...
authorDavid Mudrak <david@moodle.com>
Thu, 24 Nov 2011 16:08:49 +0000 (17:08 +0100)
committerDavid Mudrak <david@moodle.com>
Fri, 25 Nov 2011 15:01:48 +0000 (16:01 +0100)
mod/workshop/exsubmission.php
mod/workshop/lang/en/workshop.php

index d1ab70d..3a29bdf 100644 (file)
@@ -103,6 +103,15 @@ if ($id and $assess and $canassess) {
     if (!$asid) {
         $asid = $workshop->add_allocation($example, $USER->id, 0);
     }
+    if ($asid == workshop::ALLOCATION_EXISTS) {
+        // the training assessment of the example was not found but the allocation already
+        // exists. this probably means that the user is the author of the reference assessment.
+        echo $output->header();
+        echo $output->box(get_string('assessmentreferenceconflict', 'workshop'));
+        echo $output->continue_button($workshop->view_url());
+        echo $output->footer();
+        die();
+    }
     redirect($workshop->exassess_url($asid));
 }
 
index 2302ebb..f51361f 100644 (file)
@@ -53,6 +53,7 @@ $string['assessmentenddatetime'] = 'Assessment deadline: {$a->daydatetime} ({$a-
 $string['assessmentform'] = 'Assessment form';
 $string['assessmentofsubmission'] = '<a href="{$a->assessmenturl}">Assessment</a> of <a href="{$a->submissionurl}">{$a->submissiontitle}</a>';
 $string['assessmentreference'] = 'Reference assessment';
+$string['assessmentreferenceconflict'] = 'It is not possible to assess an example submission for which you provided a reference assessment.';
 $string['assessmentreferenceneeded'] = 'You have to assess this example submission to provide a reference assessment. Click \'Continue\' button to assess the submission.';
 $string['assessmentsettings'] = 'Assessment settings';
 $string['assessmentstart'] = 'Open for assessment from';