Revision: 1040
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1040&view=rev
Author:   cimorrison
Date:     2009-03-02 01:29:12 +0000 (Mon, 02 Mar 2009)

Log Message:
-----------
Fixed a problem with the rounding of booking slots to resolution boundaries.    
It was possible to make a booking that neither started nor ended on a slot 
boundary.   If a subsequent booking was made that started within the slot just 
after the previous booking ended then there would be two bookings within the 
same slot, throwing the display table into disarray.

Modified Paths:
--------------
    mrbs/trunk/web/edit_entry_handler.php

Modified: mrbs/trunk/web/edit_entry_handler.php
===================================================================
--- mrbs/trunk/web/edit_entry_handler.php       2009-03-01 23:23:29 UTC (rev 
1039)
+++ mrbs/trunk/web/edit_entry_handler.php       2009-03-02 01:29:12 UTC (rev 
1040)
@@ -269,14 +269,20 @@
                       $month, $day, $year,
                       is_dst($month, $day, $year, $hour)) + (int)($units * 
$duration);
 
-  // Round up the duration to the next whole resolution unit.
-  // If they asked for 0 minutes, push that up to 1 resolution unit.
-  $diff = $endtime - $starttime;
-  if (($tmp = $diff % $resolution) != 0 || $diff == 0)
+  // Round down the starttime and round up the endtime to the nearest slot 
boundaries                   
+  $am7=mktime($morningstarts,$morningstarts_minutes,0,
+              $month,$day,$year,is_dst($month,$day,$year,$morningstarts));
+  $starttime = round_t_down($starttime, $resolution, $am7);
+  $endtime = round_t_up($endtime, $resolution, $am7);
+  
+  // If they asked for 0 minutes, and even after the rounding the slot length 
is still
+  // 0 minutes, push that up to 1 resolution unit.
+  if ($endtime == $starttime)
   {
-    $endtime += $resolution - $tmp;
+    $endtime += $resolution;
   }
-
+ 
+  // Adjust the endtime for DST
   $endtime += cross_dst( $starttime, $endtime );
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to