Fix action on create
This commit is contained in:
11
task.py
11
task.py
@@ -20,6 +20,8 @@ def handle_task(args, last_action, conn):
|
||||
if last_action:
|
||||
active_task_id = last_action[1]
|
||||
|
||||
logging.debug('Last action, project id: {} | task id: {}'.format(active_project_id, active_task_id))
|
||||
|
||||
do_something = False
|
||||
|
||||
if args.create_name:
|
||||
@@ -39,7 +41,7 @@ def handle_task(args, last_action, conn):
|
||||
edit_task(args, args.edit_id, conn)
|
||||
|
||||
if not do_something:
|
||||
list_task(active_task_id, conn)
|
||||
list_task(active_project_id, active_task_id, conn)
|
||||
|
||||
def create_task(args, active_project_id, conn):
|
||||
logging.info('>> Create task')
|
||||
@@ -60,6 +62,7 @@ def create_task(args, active_project_id, conn):
|
||||
|
||||
task_id = cursor.lastrowid
|
||||
|
||||
logging.debug('CREATE ACTION ' + str(active_project_id) + str(task_id) )
|
||||
action.create_action(cursor, project_id=active_project_id, task_id=task_id)
|
||||
|
||||
print('created task {}: {} (status: {})'.format(task_id, args.create_name, status))
|
||||
@@ -106,12 +109,12 @@ def delete_task(task_id, conn):
|
||||
logging.error('DELETE FAILED')
|
||||
print('deleted task {}: {}'.format(task_id, 'task_name'))
|
||||
|
||||
def list_task(active_task_id, conn):
|
||||
def list_task(active_project_id, active_task_id, conn):
|
||||
logging.info('>> No arguments')
|
||||
query = "SELECT id, username, status, priority, name FROM task;" #TODO Date & time
|
||||
query = "SELECT id, username, status, priority, name FROM task WHERE project_id = ?;" #TODO Date & time
|
||||
|
||||
cursor = conn.cursor()
|
||||
cursor.execute(query)
|
||||
cursor.execute(query, (active_project_id,))
|
||||
for row in cursor.fetchall():
|
||||
nb_note = 0
|
||||
task_id, username, status, priority, name = row
|
||||
|
||||
Reference in New Issue
Block a user