Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix bug in Workshops with no teacher submissions.

  • Loading branch information...
commit 553894ced6942ef8b7f24528a91d864a8cb0f3f4 1 parent 519d369
authored August 22, 2003
22  mod/workshop/lib.php
... ...
@@ -1,4 +1,4 @@
1  
-<?PHP  // $Id: lib.php,v 1.0 14 Aug 2003
  1
+<?PHP  // $Id: lib.php,v 1.1 21 Aug 2003
2 2
 
3 3
 include_once("$CFG->dirroot/files/mimetypes.php");
4 4
 
@@ -2760,22 +2760,20 @@ function workshop_test_user_assessments($workshop, $user) {
2760 2760
 	// see if user has assessed required number of assessments of teachers submissions...
2761 2761
 	global $CFG;
2762 2762
 	
2763  
-	$result = false;
  2763
+	$result = true;
2764 2764
 	$n = 0;
2765 2765
 	$timenow =time();
2766  
-	if ($workshop->ntassessments) { // they have to pass some!
2767  
-		if ($submissions = workshop_get_teacher_submissions($workshop)) {
2768  
-			foreach ($submissions as $submission) {
2769  
-				if ($assessment = workshop_get_submission_assessment($submission, $user)) {
2770  
-					// ...the date stamp on the assessment should be in the past 
2771  
-					if ($assessment->timecreated < $timenow) {
2772  
-						$n++;
2773  
-						}
  2766
+	if ($submissions = workshop_get_teacher_submissions($workshop)) {
  2767
+		foreach ($submissions as $submission) {
  2768
+			if ($assessment = workshop_get_submission_assessment($submission, $user)) {
  2769
+				// ...the date stamp on the assessment should be in the past 
  2770
+				if ($assessment->timecreated < $timenow) {
  2771
+					$n++;
2774 2772
 					}
2775 2773
 				}
2776 2774
 			}
2777  
-		if ($n >= min($workshop->ntassessments, workshop_count_teacher_submissions($workshop))) {
2778  
-			$result = true; 
  2775
+		if ($n < min($workshop->ntassessments, workshop_count_teacher_submissions($workshop))) {
  2776
+			$result = false; 
2779 2777
 			}
2780 2778
 		}
2781 2779
 	return $result;
7  mod/workshop/view.php
... ...
@@ -1,4 +1,4 @@
1  
-<?PHP  // $Id: view.php, v1.0 14 Aug 2003
  1
+<?PHP  // $Id: view.php, v1.1 21 Aug 2003
2 2
 
3 3
 /*************************************************
4 4
 	ACTIONS handled are:
@@ -287,8 +287,9 @@
287 287
 		echo format_text($workshop->description, $workshop->format);
288 288
 		print_simple_box_end();
289 289
 		echo "<br />";
290  
-		// in Stage 1? - assess teacher's submissions ("satisfactory level" dropped 14/8/03)
291  
-		if (!workshop_test_user_assessments($workshop, $USER)) {
  290
+		// in Stage 1? - are there any teacher's submissions? and...
  291
+		// ...has student assessed the required number of the teacher's submissions ("satisfactory level" dropped 14/8/03)
  292
+		if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {
292 293
 			print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop", $course->teacher));
293 294
 			workshop_list_teacher_submissions($workshop, $USER);
294 295
 			}

0 notes on commit 553894c

Please sign in to comment.
Something went wrong with that request. Please try again.