]> git.mjollnir.org Git - moodle.git/commitdiff
Fix bug in Workshops with no teacher submissions.
authorrkingdon <rkingdon>
Fri, 22 Aug 2003 08:08:16 +0000 (08:08 +0000)
committerrkingdon <rkingdon>
Fri, 22 Aug 2003 08:08:16 +0000 (08:08 +0000)
mod/workshop/lib.php
mod/workshop/view.php

index 65a71bb74f5db37d1219398fb7554b631b6a6cb0..83b06f8ef9595c8b98759736ee121d683b28b35c 100644 (file)
@@ -1,4 +1,4 @@
-<?PHP  // $Id: lib.php,v 1.0 14 Aug 2003
+<?PHP  // $Id: lib.php,v 1.1 21 Aug 2003
 
 include_once("$CFG->dirroot/files/mimetypes.php");
 
@@ -2760,22 +2760,20 @@ function workshop_test_user_assessments($workshop, $user) {
        // see if user has assessed required number of assessments of teachers submissions...
        global $CFG;
        
-       $result = false;
+       $result = true;
        $n = 0;
        $timenow =time();
-       if ($workshop->ntassessments) { // they have to pass some!
-               if ($submissions = workshop_get_teacher_submissions($workshop)) {
-                       foreach ($submissions as $submission) {
-                               if ($assessment = workshop_get_submission_assessment($submission, $user)) {
-                                       // ...the date stamp on the assessment should be in the past 
-                                       if ($assessment->timecreated < $timenow) {
-                                               $n++;
-                                               }
+       if ($submissions = workshop_get_teacher_submissions($workshop)) {
+               foreach ($submissions as $submission) {
+                       if ($assessment = workshop_get_submission_assessment($submission, $user)) {
+                               // ...the date stamp on the assessment should be in the past 
+                               if ($assessment->timecreated < $timenow) {
+                                       $n++;
                                        }
                                }
                        }
-               if ($n >= min($workshop->ntassessments, workshop_count_teacher_submissions($workshop))) {
-                       $result = true; 
+               if ($n < min($workshop->ntassessments, workshop_count_teacher_submissions($workshop))) {
+                       $result = false; 
                        }
                }
        return $result;
index fcc9f1100d732d5b6d127d45f12c95b9d5984f30..6257d6cd3bc270586787ddef8573b1bde8792613 100644 (file)
@@ -1,4 +1,4 @@
-<?PHP  // $Id: view.php, v1.0 14 Aug 2003
+<?PHP  // $Id: view.php, v1.1 21 Aug 2003
 
 /*************************************************
        ACTIONS handled are:
                echo format_text($workshop->description, $workshop->format);
                print_simple_box_end();
                echo "<br />";
-               // in Stage 1? - assess teacher's submissions ("satisfactory level" dropped 14/8/03)
-               if (!workshop_test_user_assessments($workshop, $USER)) {
+               // in Stage 1? - are there any teacher's submissions? and...
+               // ...has student assessed the required number of the teacher's submissions ("satisfactory level" dropped 14/8/03)
+               if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {
                        print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop", $course->teacher));
                        workshop_list_teacher_submissions($workshop, $USER);
                        }