Beispiel #1
0
 def _new(self, name, deadline, project = None):
     nextaction = Action(
         name = name,
         deadline = deadline,
         project = project)
     nextaction.save()
     return nextaction
Beispiel #2
0
 def _empty_project(self):
     for p in Project.select():
         if len(Action.select().where(Action.project == p.id,
                                      Action.completed == False)) == 0:
             if len(Project.select().where(Project.parent == p.id)) == 0:
                 return p
     return None
Beispiel #3
0
 def _nextaction(self):
     actions = Action.select().where(Action.completed == False)
     nextaction = actions[0]
     for a in actions:
         if a.deadline < nextaction.deadline:
             nextaction = a
     return nextaction
Beispiel #4
0
 def __fillprojectaction(self, project):
     lastcompletednotice = ""
     lastdone = Action.select().filter(Action.project_id == project.id,
                                       Action.completed == True).order_by(
                                           Action.deadline.desc())
     if lastdone:
         lastcompletednotice += "\nlast completed action: {lastdone[0].name} at {lastdone[0].deadline}".format(
             **locals())
     return self._new(
         "Add an action to project {project.id}: {project.name}".format(
             **locals()) + lastcompletednotice,
         date.today(),
         project=project)
Beispiel #5
0
 def _new(self, name, deadline, project=None):
     nextaction = Action(name=name, deadline=deadline, project=project)
     nextaction.save()
     return nextaction
Beispiel #6
0
 def _add(self, options):
     action = Action(**options)
     action.save()
Beispiel #7
0
 def _add(self, options):
     action = Action(**options) 
     action.save()