Exemplo n.º 1
0
 def add_task(self, task):
     bucket_tag = common_utils.determine_bucket(task)
     if bucket_tag == "ACTIVE":
         self.active_tasks.add_task(task)
     elif bucket_tag == "COMPLETED":
         self.completed_tasks.add_task(task)
     else:
         self.pending_tasks.add_task(task)
Exemplo n.º 2
0
    def edit_task(self, task):
        bucket_tag = common_utils.determine_bucket(task)

        if bucket_tag == "ACTIVE":
            bucket = self.active_tasks
        elif bucket_tag == "COMPLETED":
            bucket = self.completed_tasks
        else:
            bucket = self.pending_tasks

        replaced_task = bucket.get_by_id(task.id)
        bucket.remove_task(replaced_task)
        bucket.add_task(task)
        return task