WIP Work on action
Very restrictive - use a 'current' table
This commit is contained in:
15
note.py
15
note.py
@@ -7,7 +7,8 @@ import datetime
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import action
|
||||
from action import record_action
|
||||
from action import TypeAction
|
||||
import project
|
||||
|
||||
from args import get_string_arg
|
||||
@@ -31,7 +32,7 @@ def handle_note(args, last_action, conn):
|
||||
sys.exit(1)
|
||||
|
||||
note = Note()
|
||||
note.message = get_string_arg(args[1], 'note message')
|
||||
note.message = get_string_arg(args[1:], 'note message')
|
||||
create_note(note, last_action.project_id, last_action.task_id, conn)
|
||||
elif args[0] == '-e':
|
||||
if len(args) == 1:
|
||||
@@ -73,7 +74,9 @@ def create_note(note, active_project_id, active_task_id, conn):
|
||||
|
||||
note_id = cursor.lastrowid
|
||||
|
||||
action.create_action(cursor, project_id=active_project_id, task_id = active_task_id, note_id=note_id)
|
||||
action_message = '{} (task: {})'.format(note.message, active_task_id)
|
||||
record_action(cursor, TypeAction.CREATE, action_message, active_project_id, active_task_id, note_id)
|
||||
logging.debug(action_message)
|
||||
|
||||
print('created note {}: {} (task {})'.format(note_id, note.message, active_task_id))
|
||||
|
||||
@@ -90,8 +93,10 @@ def edit_note(note, note_id, last_action, conn):
|
||||
print('could not find note {}'.format(note_id))
|
||||
sys.exit(1)
|
||||
|
||||
record_action(cursor, TypeAction.UPDATE, note.message, last_action.project_id,
|
||||
last_action.task_id, last_action.note_id)
|
||||
|
||||
print('updated note {}: (message: {}, task {})'.format(note_id, note.message, last_action.task_id))
|
||||
action.create_action(cursor, project_id=last_action.project_id, task_id=last_action.task_id, note_id=note_id)
|
||||
|
||||
def delete_note(note_id, conn):
|
||||
logging.info('>> Remove note')
|
||||
@@ -108,6 +113,8 @@ def delete_note(note_id, conn):
|
||||
print('could not find note {}'.format(note_id))
|
||||
sys.exit(1)
|
||||
|
||||
record_action(cursor, TypeAction.DELETE, 'delete note')
|
||||
|
||||
print('deleted note {}: {}'.format(note_id, 'note_name'))
|
||||
|
||||
def list_note(active_project_id, active_task_id, active_note_id, conn):
|
||||
|
||||
Reference in New Issue
Block a user