[Erp5-report] r14206 - /erp5/trunk/products/ERP5/Document/PresencePeriod.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 24 23:40:05 CEST 2007


Author: romain
Date: Tue Apr 24 23:40:04 2007
New Revision: 14206

URL: http://svn.erp5.org?rev=14206&view=rev
Log:
Improve time precision by using the addToDate method

Modified:
    erp5/trunk/products/ERP5/Document/PresencePeriod.py

Modified: erp5/trunk/products/ERP5/Document/PresencePeriod.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PresencePeriod.py?rev=14206&r1=14205&r2=14206&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PresencePeriod.py (original)
+++ erp5/trunk/products/ERP5/Document/PresencePeriod.py Tue Apr 24 23:40:04 2007
@@ -143,7 +143,7 @@
       stop_date = self.getStopDate(start_date)
       periodicity_stop_date = self.getPeriodicityStopDate(
                                           start_date)
-      duration = stop_date - start_date
+      second_duration = int(stop_date) - int(start_date)
       # First date has to respect the periodicity config
       next_start_date = self.getNextPeriodicalDate(start_date-1)
       while (next_start_date is not None) and \
@@ -163,7 +163,8 @@
            (current_exception_date < next_start_date.Date()):
           # SQL method don't like iterator
 #             yield (next_start_date, next_start_date+duration)
-          result.append([next_start_date, next_start_date+duration])
+          result.append([next_start_date, 
+		         addToDate(next_start_date, second=second_duration)])
           # Update the next exception date
           if len(exception_date_list) != 0:
             current_exception_date = exception_date_list.pop(0).Date()
@@ -172,7 +173,8 @@
         else:
           # SQL method don't like iterator
 #             yield (next_start_date, next_start_date+duration)
-          result.append([next_start_date, next_start_date+duration])
+          result.append([next_start_date, 
+		         addToDate(next_start_date, second=second_duration)])
         next_start_date = self.getNextPeriodicalDate(next_start_date)
 
     return result




More information about the Erp5-report mailing list