Revision: 2967
          https://sourceforge.net/p/mrbs/code/2967/
Author:   cimorrison
Date:     2015-01-20 17:29:57 +0000 (Tue, 20 Jan 2015)
Log Message:
-----------
Fixed bugs in calculation of periods in time slot selectors in edit_entry form

Modified Paths:
--------------
    mrbs/trunk/web/js/edit_entry.js.php

Modified: mrbs/trunk/web/js/edit_entry.js.php
===================================================================
--- mrbs/trunk/web/js/edit_entry.js.php 2015-01-20 16:50:33 UTC (rev 2966)
+++ mrbs/trunk/web/js/edit_entry.js.php 2015-01-20 17:29:57 UTC (rev 2967)
@@ -703,10 +703,16 @@
   var durDays;
   var minutesPerDay = <?php echo MINUTES_PER_DAY ?>;
 
+  
   durUnits = (enablePeriods) ? '<?php echo "periods" ?>' : '<?php echo 
"minutes" ?>';
   duration = to - from;
   duration = Math.floor((to - from) / 60);
   
+  if (enablePeriods)
+  {
+    duration++;  <?php // a period is a period rather than a point ?>
+  }
+  
   <?php
   // Adjust the days and duration so that 0 <= duration < minutesPerDay.    If 
we're using
   // periods then if necessary add/subtract multiples of the number of periods 
in a day
@@ -715,21 +721,15 @@
   if (durDays !== 0)
   {
     days += durDays;
-    duration -= durDays * ((enablePeriods) ? $('#rooms' + 
currentArea).find('option').length : minutesPerDay);
+    duration -= durDays * ((enablePeriods) ? $('#start_seconds' + 
currentArea).find('option').length : minutesPerDay);
   }
   
-  if (enablePeriods)
+  if (!enablePeriods && (duration >= 60))
   {
-    duration++;  <?php // a period is a period rather than a point ?>
+    durUnits = "hours";
+    duration = durFormat(duration/60);
   }
-  else
-  {
-    if (duration >= 60)
-    {
-      durUnits = "hours";
-      duration = durFormat(duration/60);
-    }
-  }
+
   <?php
   // As durFormat returns a string, duration can now be either
   // a number or a string, so convert it to a string so that we
@@ -752,6 +752,7 @@
     text += duration + ' ';
     text += (duration === '1') ? vocab[durUnits].singular : 
vocab[durUnits].plural;
   }
+
   return text;
 }
   
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to