fixes bug: setting user who is not present in pianist-table is no longer allowed
This commit is contained in:
@@ -27,7 +27,8 @@ At the moment, an alpha version is undertaken, with these features:
|
|||||||
- Works are shown sorted by composer and opus/work_directory-number (`s`, `smo`) or by composer and collection (`sm`)
|
- Works are shown sorted by composer and opus/work_directory-number (`s`, `smo`) or by composer and collection (`sm`)
|
||||||
- Remove work or movement from being mastered for active user (`r number_of_work` or `r number_of_work number_of_movement`)
|
- Remove work or movement from being mastered for active user (`r number_of_work` or `r number_of_work number_of_movement`)
|
||||||
- Remove user (`delete_my_user_record_including_all_mastered_works`)
|
- Remove user (`delete_my_user_record_including_all_mastered_works`)
|
||||||
- Fix bug: double marking crashes the program
|
- Fixed bug: double marking crashes the program
|
||||||
|
- Fixed bug: check for user before setting
|
||||||
|
|
||||||
_(planned) Release piano_repertoire_cli V 0.0.1 alpha (learn about versioning before)_
|
_(planned) Release piano_repertoire_cli V 0.0.1 alpha (learn about versioning before)_
|
||||||
|
|
||||||
@@ -44,6 +45,5 @@ _(planned) Port funtionality to a kivy-GUI_
|
|||||||
|
|
||||||
## Known Bugs
|
## Known Bugs
|
||||||
|
|
||||||
- User numbers are allowed to set without a user being present, with marking works as mastered leading to crash the program
|
|
||||||
- Trying to mark works as mastered that are not present crashes the program
|
- Trying to mark works as mastered that are not present crashes the program
|
||||||
- Providing alphabetic chars where numbers are expected crashes the program
|
- Providing alphabetic chars where numbers are expected crashes the program
|
||||||
14
rep_cli.py
14
rep_cli.py
@@ -23,9 +23,19 @@ class Session:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def set_user(self, arguments):
|
def set_user(self, arguments):
|
||||||
|
resultstring = ''
|
||||||
db_index = arguments[0]
|
db_index = arguments[0]
|
||||||
self.user = db_index
|
sql_command = f'''
|
||||||
return 'User set'
|
SELECT *
|
||||||
|
FROM pianist
|
||||||
|
WHERE id = {db_index}
|
||||||
|
'''
|
||||||
|
if self.db_agent.execute(sql_command).fetchone():
|
||||||
|
self.user = db_index
|
||||||
|
resultstring += 'User set'
|
||||||
|
else:
|
||||||
|
resultstring += 'No such user'
|
||||||
|
return resultstring
|
||||||
|
|
||||||
def get_active_user(self):
|
def get_active_user(self):
|
||||||
sql_command = f'''
|
sql_command = f'''
|
||||||
|
|||||||
Reference in New Issue
Block a user