Fixes Issue 625 where the Duplicate calculation would hang if no assigned slots where available.
authorMario Ferraro <fadinlight@gmail.com>
Sat, 09 May 2009 01:36:22 +0200
changeset 2301 fd14daa4b45a
parent 2300 b9fd1e20d413
child 2302 7b281ac17abd
Fixes Issue 625 where the Duplicate calculation would hang if no assigned slots where available. Reviewed by: Lennard de Rijk
app/soc/content/js/duplicate-slots-090331.js
--- a/app/soc/content/js/duplicate-slots-090331.js	Sat May 09 01:14:03 2009 +0200
+++ b/app/soc/content/js/duplicate-slots-090331.js	Sat May 09 01:36:22 2009 +0200
@@ -11,13 +11,19 @@
 
   this.showDuplicatesInit = function() {
 
+    html_string = '';
     // Remember this object for Javascript scoping
-    html_string = '';
     var this_object = this;
     var NUMBER_OF_ORGS = number_of_orgs;
     var OFFSET_LENGTH = offset_length;
     // Variables to handle progress bar updating
     var ITERATIONS = (number_of_orgs % offset_length)==0 ? Math.floor(number_of_orgs/offset_length) : Math.floor(number_of_orgs/offset_length)+1;
+
+    if (ITERATIONS==0) {
+      $("#div_duplicate_slots").html("<strong>No org slots to process</strong>");
+      return;
+    }
+
     var successful_calls = 0;
 
     $("#id_button_duplicate_slots").fadeOut("slow",