[Mpuls-commits] r2830 - base/trunk/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 31 12:04:58 CEST 2010


Author: torsten
Date: 2010-05-31 12:04:55 +0200 (Mon, 31 May 2010)
New Revision: 2830

Modified:
   base/trunk/mpulsweb/model/appointment.py
Log:
* mpulsweb/model/appointment.py (Appointment.setData): If no enddate
	was given assume a 24h appointment -> start_date + 24h = end_date



Modified: base/trunk/mpulsweb/model/appointment.py
===================================================================
--- base/trunk/mpulsweb/model/appointment.py	2010-05-31 10:04:46 UTC (rev 2829)
+++ base/trunk/mpulsweb/model/appointment.py	2010-05-31 10:04:55 UTC (rev 2830)
@@ -377,9 +377,16 @@
         self.start_date = self._convert2Datetime(data.get('start_date'),
                                                  data.get('start_time'))
 
-        self.end_date = self._convert2Datetime(data.get('end_date'),
-                                               data.get('end_time'))
+        end_date = self._convert2Datetime(data.get('end_date'),
+                                          data.get('end_time'))
 
+        # If no enddate is given assume a 24h appointment
+        if not end_date:
+            # Add 24 hours to startdate
+            self.end_date = self.start_date + timedelta(hours=24)
+        else:
+            self.end_date = end_date
+
         self.description = data.get('description', self.description)
         self.case_id = data.get('case_id', self.case_id)
 



More information about the Mpuls-commits mailing list