Update project log line
This commit is contained in:
17
pits.py
17
pits.py
@@ -60,6 +60,7 @@ def handle_project(args, last_action):
|
|||||||
logging.error('DELETE FAILED')
|
logging.error('DELETE FAILED')
|
||||||
print('deleted project {}: {}'.format(args.delete_id, 'project_name'))
|
print('deleted project {}: {}'.format(args.delete_id, 'project_name'))
|
||||||
if args.edit_id:
|
if args.edit_id:
|
||||||
|
project_id = args.edit_id
|
||||||
do_something = True
|
do_something = True
|
||||||
logging.info('>> Edit project')
|
logging.info('>> Edit project')
|
||||||
|
|
||||||
@@ -77,22 +78,26 @@ def handle_project(args, last_action):
|
|||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
if update_args:
|
if update_args:
|
||||||
logging.debug('Do a project update')
|
logging.debug('Do a project update')
|
||||||
cursor.execute(query, (args.edit_id,))
|
cursor.execute(query, (project_id,))
|
||||||
|
|
||||||
create_action(cursor, args.edit_id, message = 'update ' + str(update_args))
|
log_args = ', '.join("%s: '%s'" % (k, v) for k, v in update_args.items())
|
||||||
|
print('updated project {}: ({})'.format(project_id, log_args))
|
||||||
|
else:
|
||||||
|
print('updated project {}: set active project')
|
||||||
|
|
||||||
|
create_action(cursor, project_id, message = 'update ' + str(update_args))
|
||||||
|
|
||||||
if not do_something:
|
if not do_something:
|
||||||
logging.info('>> No arguments')
|
logging.info('>> No arguments')
|
||||||
query = "SELECT id, username, name, status, created_at FROM project;"
|
query = "SELECT id, username, name, status, created_at FROM project;"
|
||||||
current_project = ' '
|
|
||||||
with sqlite3.connect(db_filename) as conn:
|
with sqlite3.connect(db_filename) as conn:
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
for row in cursor.fetchall():
|
for row in cursor.fetchall():
|
||||||
project_id, username, name, status, date = row
|
project_id, username, name, status, date = row
|
||||||
nb_task = 0
|
nb_task = 0
|
||||||
if last_action and last_action[0] == project_id:
|
current_project = ' '
|
||||||
current_project = '*'
|
if last_action and last_action[0] == project_id: current_project = '*'
|
||||||
print('{} {:2d}: ({:16}) | {} | {} ({} tasks )'.format(current_project, project_id, username, status, name, nb_task))
|
print('{} {:2d}: ({:16}) | {} | {} ({} tasks )'.format(current_project, project_id, username, status, name, nb_task))
|
||||||
# TODO Print creation date
|
# TODO Print creation date
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user