def new_task(employee_name=None, task_name=None, time_elapsed=None, notes=None): """Report a new task""" if not employee_name: employee_name = _get_name() if not task_name: task_name = _get_task_name() if not time_elapsed: time_elapsed = _get_time_elapsed() if not notes: notes = _get_notes() Tasks.create(employee_name=employee_name, task_name=task_name, time_elapsed=time_elapsed, notes=notes) input('Entry Added. Press any key to continue.')
def add_tasks(self, force): params = self.get_params() tasks_file = path(params["tasks_path"]) completed_file = tasks_file.dirname().joinpath("completed.json") if tasks_file.exists() and not force: tasks = Tasks.load(tasks_file) completed = Tasks.load(completed_file) else: tasks, completed = Tasks.create(params) tasks.save(tasks_file) completed.save(completed_file) task_queue = self.get_task_queue() added_tasks = Tasks() for task_name in sorted(tasks.keys()): task = tasks[task_name] complete = completed[task_name] if force or not complete: task_queue.put(task) added_tasks[task_name] = task logger.info("%d tasks queued", len(added_tasks)) return added_tasks