Ejemplo n.º 1
0
 def post(self, task_id, completed_on):
     completion_date = parsedate(completed_on)
     task = self.session.query(
         orm.Task).filter(orm.Task.task_id == task_id).one()
     if task.last_completed is None or completion_date > task.last_completed:
         task.complete(self.current_user, parsedate(completed_on))
         self.session.commit()
     else:
         self.current_user.notify(
             'error', "You already completed '{}' on {}".format(
                 task.name, date_str(completion_date)), task.task_id)
         self.session.commit()
     self.redirect(Main)
Ejemplo n.º 2
0
 def post(self, task_id, completed_on):
     completion_date = parsedate(completed_on)
     task = self.session.query(orm.Task).filter(orm.Task.task_id == task_id).one()
     if task.last_completed is None or completion_date > task.last_completed:
         task.complete(self.current_user, parsedate(completed_on))
         self.session.commit()
     else:
         self.current_user.notify('error',
                                  "You already completed '{}' on {}"
                                  .format(task.name,
                                          date_str(completion_date)),
                                  task.task_id)
         self.session.commit()
     self.redirect(Main)
Ejemplo n.º 3
0
 def __repr__(self):
     return '{name} starts on {date} and recurs every {length}'\
         .format(name = self.name,
                 date = utils.date_str(self.first_due),
                 length = utils.time_str(self.length.days))