BOT_NAME = os.environ.get('GOAL_BOT')
BOT_PWD = os.environ.get('GOAL_BOT_PWD')
-def get_bot():
- creds = botlib.Creds(SERVER, BOT_NAME, BOT_PWD)
- return botlib.Bot(creds)
DATE_FORMAT = '%Y-%m-%d'
results = pretty_print(goal, tasks)
return results
+ if match.command('remove'):
+ task_id = int(match.args()[1])
+ result = Data().remove_task(task_id)
+ return [result]
+
if match.command('extra.help'):
return [ex_help]
session.commit()
return goal_id
+ def remove_task(self, task_id):
+ task_name = ''
+ with Session(self.engine) as session:
+ cmd = select(Task).where(Task.id == task_id)
+ to_remove = session.exec(cmd).first()
+ task_name = to_remove.name
+ session.delete(to_remove)
+ session.commit()
+ return f'Removed task "{task_name}"'
+
def assign_vision(self, goal_id, vision_id):
'''Goals may move between visions'''
self._set_pref_goal_id(goal_id)
result = Data().add_task(goal_id=goal_id, name=name)
print(result)
+@task
+def remove_task(c, goal_id, name):
+ result = Data().add_task(goal_id=goal_id, name=name)
+ print(result)
+
+
@task
def list(c):