def _check_start(self, key, data): if data == 'now': data = now() result = convert_to_datetime(data) if not self.end: # set a default end time for project! 3 months self.end = result + datetime.timedelta(days=31 * 3) return result
def _check_end(self, key, data): end = convert_to_datetime(data) start = convert_to_datetime(self.start) if start and end: data = max(start, end) # if any errors in end if data and self.project and self.project.end: try: data = min(data, self.project.end) except TypeError: pass #delta = data - start self.end_set = True # if not hasattr(self, 'effort_set'): # self.duration = delta.days * 24 + delta.seconds / 3600.0 if isinstance(data, datetime.datetime): return data else: return now()
def _check_start(self, key, data): if data == 'now': data = datetime.datetime.utcnow() else: data = convert_to_datetime(data) if data and self.project and self.project.end: try: data = min(data, self.project.end) except TypeError: pass if self.project: if data == self.project.end and self.effort: # approximate fix data = data - datetime.timedelta(hours=self.effort * 4) if isinstance(data, datetime.datetime): return data else: return now()
def _check_end(self, key, data): result = convert_to_datetime(data) # if self.start and data<=self.start: ## result = self.start + datetime.timedelta(days=31*3) return result
def _update_computed_end(self, key, data): return convert_to_datetime(data)
def check_agreement_end(self, key, data): data = convert_to_datetime(data) if not data: data = now() return data