Ejemplo n.º 1
0
 def do_job(self):
     task = Task.get_last_task()
     if task:
         task.title = ' '.join(self.args.task)
         DBSession.commit()
     else:
         print 'Last task not found'
Ejemplo n.º 2
0
 def do_job(self):
     active_task = Task.get_active_task()
     if active_task:
         print('Aborting active task: %s' % active_task)
         DBSession.delete(active_task)
         DBSession.commit()
     else:
         print("You don't have any active task")
Ejemplo n.º 3
0
    def do_job(self):
        active_task = Task.get_active_task()
        if not active_task:
            print("You don't have any active task")
            return

        active_task.end()
        DBSession.commit()
        print('Task ended: %s' % active_task)
Ejemplo n.º 4
0
    def do_job(self):
        active_task = Task.get_active_task()
        if active_task:
            print('You have an active task: %s' % active_task)
            answer = input(
                "Do you want to terminate the currently active task ([y]/n)? ")
            if not answer or answer.lower() == 'y':
                active_task.end()
            else:
                return

        subject = Subject.ensure(self.args.subject)
        task = Task(title=' '.join(self.args.task),
                    user=config.user
                    if hasattr(config, 'user') else os.environ.get('USER'))
        subject.tasks.append(task)

        DBSession.commit()
        print('Started task: %s' % task)
Ejemplo n.º 5
0
    def process_row(self, row):
        subject_name, task_name, start_time, end_time = row
        start_time = datetime.strptime(start_time, config.datetime_format)
        end_time = datetime.strptime(end_time, config.datetime_format)

        if subject_name not in self.subjects:
            self.subjects[subject_name] = Subject.ensure(subject_name)
            DBSession.commit()

        task = Task(title=task_name, start_time=start_time, end_time=end_time)
        self.subjects[subject_name].tasks.append(task)
        print('Adding %s' % task)
        DBSession.commit()
Ejemplo n.º 6
0
    def do_job(self):
        task = Task.get_last_task()
        if task:
            if self.args.title:
                task.title = self.args.title

            if self.args.end_time:
                task.end_time = self.parse_datetime(self.args.end_time)

            if self.args.start_time:
                task.start_time = self.parse_datetime(self.args.start_time)

            DBSession.commit()
        else:
            print('Last task not found')
Ejemplo n.º 7
0
    def do_job(self):
        task = Task.get_last_task()
        if task:
            if self.args.title:
                task.title = self.args.title

            if self.args.end_time:
                task.end_time = self.parse_datetime(self.args.end_time)

            if self.args.start_time:
                task.start_time = self.parse_datetime(self.args.start_time)

            DBSession.commit()
        else:
            print('Last task not found')
Ejemplo n.º 8
0
    def do_job(self):
        active_task = Task.get_active_task()
        if active_task:
            print 'You have an active task: %s' % active_task
            answer = raw_input("Do you want to terminate the currently active task ([y]/n)? ")
            if not answer or answer.lower() == 'y':
                active_task.end()
            else:
                return

        subject = Subject.ensure(self.args.subject)
        task = Task(title=' '.join(self.args.task))
        subject.tasks.append(task)

        DBSession.commit()
        print 'Started task: %s' % task
Ejemplo n.º 9
0
def task_completer(prefix, **kwargs):
    try:
        return [c for c in Task.all_titles() if c.startswith(prefix)]
    except Exception as ex:
        return [str(ex)]
Ejemplo n.º 10
0
 def do_job(self):
     active_task = Task.get_active_task()
     if active_task:
         print('Active task: %s' % active_task)
     else:
         print("You don't have any active task")
Ejemplo n.º 11
0
 def do_job(self):
     active_task = Task.get_active_task()
     if active_task:
         print('Active task: %s' % active_task)
     else:
         print("You don't have any active task")