Improve how to retrieve & handle actions
This commit is contained in:
10
project.py
10
project.py
@@ -27,10 +27,7 @@ def handle_project(args, last_action, conn):
|
||||
edit_project(args, args.edit_id, conn)
|
||||
|
||||
if not do_something:
|
||||
active_project_id = None
|
||||
if last_action:
|
||||
active_project_id = last_action[0]
|
||||
list_project(active_project_id, conn)
|
||||
list_project(last_action.project_id, conn)
|
||||
|
||||
def create_project(args, conn):
|
||||
# TODO Project is same name is forbidden
|
||||
@@ -104,6 +101,5 @@ def list_project(active_project_id, conn):
|
||||
cursor.execute(query)
|
||||
for row in cursor.fetchall():
|
||||
project_id, username, name, status, date, nb_task = row
|
||||
current_project = ''
|
||||
if active_project_id and active_project_id == project_id: current_project = '*'
|
||||
print('{:1} {:2d}: ({:8}) | {} | {} ({} tasks)'.format(current_project, project_id, username, status, name, nb_task))
|
||||
print('{:1} {:2d}: ({:8}) | {} | {} ({} tasks)'.format('*' if active_project_id == project_id else '',
|
||||
project_id, username, status, name, nb_task))
|
||||
Reference in New Issue
Block a user