-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgameReturn.py
More file actions
30 lines (23 loc) · 1.08 KB
/
gameReturn.py
File metadata and controls
30 lines (23 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
A module containing function that prompt the store manager for the ID of the game they wish to return.
It should provide either an appropriate error message or a confirmation message.
If the ID is invalid, or the game is already available, it returns an error message.
"""
from database import is_valid_game_id
from database import is_game_available
from database import set_game_as_available
def return_game(game_copy_id):
if game_copy_id == '':
return 'Game Copy ID is required'
is_valid = is_valid_game_id(game_copy_id)
if is_valid == False:
return (f'Provided Game Copy ID {game_copy_id} is invalid')
is_available = is_game_available(game_copy_id)
if is_available == True:
return (f'Provided Game Copy ID {game_copy_id} is already in store')
set_game_as_available(game_copy_id)
return (f'Game Copy ID {game_copy_id} has been successfully returned to store')
if __name__=="__main__":
#test code for return game functionality
print('Test for return game functionality:')
print(return_game(1))