New feature: m number_of_work number_of_movement marks single movements as mastered
This commit is contained in:
@@ -20,7 +20,8 @@ At the moment, an alpha version is undertaken, with these features:
|
|||||||
- Mark pieces as mastered for the active user (`m number_of_work`)
|
- Mark pieces as mastered for the active user (`m number_of_work`)
|
||||||
- Show pieces by composer (`sc` shows composers, `c number_of_composer` shows pieces)
|
- Show pieces by composer (`sc` shows composers, `c number_of_composer` shows pieces)
|
||||||
- Show movements through pieces (`sp piece_number`)
|
- Show movements through pieces (`sp piece_number`)
|
||||||
- (planned) Mark movement as mastered for active user
|
- Mark movement as mastered for active user (`m number_of_work number_of_movement`)
|
||||||
|
- (planned) Show mastered works/movements for activated user
|
||||||
- (planned) Save recordings per movement in db
|
- (planned) Save recordings per movement in db
|
||||||
- (planned) Listen to saved recordings
|
- (planned) Listen to saved recordings
|
||||||
|
|
||||||
|
|||||||
16
rep_cli.py
16
rep_cli.py
@@ -32,7 +32,7 @@ class Session:
|
|||||||
elif command == 'c':
|
elif command == 'c':
|
||||||
self.resultstring += self.show_composers()
|
self.resultstring += self.show_composers()
|
||||||
elif command == 'm':
|
elif command == 'm':
|
||||||
self.resultstring += self.mark_work_as_mastered(arguments[0])
|
self.resultstring += self.mark_work_as_mastered(arguments)
|
||||||
elif command == 'n':
|
elif command == 'n':
|
||||||
self.create_new_user(arguments[0], arguments[1])
|
self.create_new_user(arguments[0], arguments[1])
|
||||||
self.resultstring += f'Created new user {arguments[0]} {arguments[1]}.'
|
self.resultstring += f'Created new user {arguments[0]} {arguments[1]}.'
|
||||||
@@ -104,16 +104,26 @@ class Session:
|
|||||||
fun_resultstring += f'{work.id()}: {work.pretty_string()}\n'
|
fun_resultstring += f'{work.id()}: {work.pretty_string()}\n'
|
||||||
return fun_resultstring
|
return fun_resultstring
|
||||||
|
|
||||||
def mark_work_as_mastered(self, work_id):
|
def mark_work_as_mastered(self, arguments):
|
||||||
|
work_id = arguments[0]
|
||||||
resultstring = 'adding:\n'
|
resultstring = 'adding:\n'
|
||||||
work = work_under_id(work_id, self.db_agent)
|
work = work_under_id(work_id, self.db_agent)
|
||||||
for mov_number in work.values['movements'].keys():
|
if len(arguments) > 1:
|
||||||
|
mov_number = int(arguments[1])
|
||||||
sql_command = f'''
|
sql_command = f'''
|
||||||
INSERT INTO is_able_to_play (work_id, mov_id, pianist_id)
|
INSERT INTO is_able_to_play (work_id, mov_id, pianist_id)
|
||||||
VALUES ({work_id}, {mov_number}, {self.user})
|
VALUES ({work_id}, {mov_number}, {self.user})
|
||||||
'''
|
'''
|
||||||
self.db_agent.execute(sql_command)
|
self.db_agent.execute(sql_command)
|
||||||
resultstring += f'{work.pretty_mov(mov_number)}\n'
|
resultstring += f'{work.pretty_mov(mov_number)}\n'
|
||||||
|
else:
|
||||||
|
for mov_number in work.values['movements'].keys():
|
||||||
|
sql_command = f'''
|
||||||
|
INSERT INTO is_able_to_play (work_id, mov_id, pianist_id)
|
||||||
|
VALUES ({work_id}, {mov_number}, {self.user})
|
||||||
|
'''
|
||||||
|
self.db_agent.execute(sql_command)
|
||||||
|
resultstring += f'{work.pretty_mov(mov_number)}\n'
|
||||||
return resultstring
|
return resultstring
|
||||||
|
|
||||||
# End session
|
# End session
|
||||||
|
|||||||
Reference in New Issue
Block a user