Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix bug when deleting a submission. Very recent assessments were not

deleted. Now all assessments of the deleted submission are deleted
including the "hot" ones.
  • Loading branch information...
commit 4511133418722a84f8e3c2fc79f1ea69b805223f 1 parent 88cc4a0
authored August 29, 2003
16  mod/workshop/lib.php
@@ -1016,13 +1016,19 @@ function workshop_file_area_name($workshop, $submission) {
1016 1016
 }
1017 1017
 
1018 1018
 
1019  
-function workshop_get_assessments($submission) {
1020  
-	// Return all assessments for this submission provided they are after the editing time, ordered oldest first, newest last
  1019
+function workshop_get_assessments($submission, $all = '') {
  1020
+	// Return assessments for this submission ordered oldest first, newest last
  1021
+	// new assessments made withinthe editing time are NOT return unless the
  1022
+	// second argument is set to ALL
1021 1023
 	global $CFG;
1022 1024
 
1023  
-	$timenow = time();
1024  
-    return get_records_select("workshop_assessments", "(submissionid = $submission->id) AND 
1025  
-		(timecreated < $timenow - $CFG->maxeditingtime)", "timecreated DESC");
  1025
+	if ($all != 'ALL') {
  1026
+		$timenow = time();
  1027
+		return get_records_select("workshop_assessments", "(submissionid = $submission->id) AND 
  1028
+			(timecreated < $timenow - $CFG->maxeditingtime)", "timecreated DESC");
  1029
+	} else {
  1030
+		return get_records_select("workshop_assessments", "submissionid = $submission->id", "timecreated DESC");
  1031
+	}
1026 1032
 }
1027 1033
 
1028 1034
 
4  mod/workshop/submissions.php
@@ -136,7 +136,7 @@
136 136
 			}
137 137
 		print_string("deleting", "workshop");
138 138
 		// first get any assessments...
139  
-		if ($assessments = workshop_get_assessments($submission)) {
  139
+		if ($assessments = workshop_get_assessments($submission, 'ALL')) {
140 140
 			foreach($assessments as $assessment) {
141 141
 				// ...and all the associated records...
142 142
 				delete_records("workshop_comments", "assessmentid", $assessment->id);
@@ -893,7 +893,7 @@
893 893
 			}
894 894
 		print_string("deleting", "workshop");
895 895
 		// first get any assessments...
896  
-		if ($assessments = workshop_get_assessments($submission)) {
  896
+		if ($assessments = workshop_get_assessments($submission, 'ALL')) {
897 897
 			foreach($assessments as $assessment) {
898 898
 				// ...and all the associated records...
899 899
 				delete_records("workshop_comments", "assessmentid", $assessment->id);

0 notes on commit 4511133

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