Changes 'quit message' mgmt & product selection #5
This commit is contained in:
parent
2aa2f73dd7
commit
f77c7ad09d
11
cli.py
11
cli.py
|
@ -22,7 +22,7 @@ from config import DB_REQUEST, CLI_MSG_DISCLAIMER, CLI_MSG_ASK_IDX, \
|
|||
CLI_ITEM_LIST, CLI_MSG_ASK_BAK, CLI_MSG_BAK_DONE
|
||||
cli_end_msg = str()
|
||||
product_asked = {'valid_item': False}
|
||||
|
||||
cli_end_msg = CLI_MSG_QUIT
|
||||
|
||||
def ask_user(head_msg, item_list):
|
||||
"""
|
||||
|
@ -240,13 +240,4 @@ if product_asked['valid_item']:
|
|||
if LOCAL_DB.cursor.rowcount == 1:
|
||||
cli_end_msg = CLI_MSG_BAK_DONE
|
||||
|
||||
else:
|
||||
cli_end_msg = CLI_MSG_QUIT
|
||||
|
||||
else:
|
||||
cli_end_msg = CLI_MSG_QUIT
|
||||
|
||||
else:
|
||||
cli_end_msg = CLI_MSG_QUIT
|
||||
|
||||
print(cli_end_msg)
|
||||
|
|
|
@ -28,7 +28,7 @@ FIELD_KEPT = {
|
|||
# CLI
|
||||
DB_REQUEST = {
|
||||
'list_cat': "SELECT c.name, COUNT(*) AS 'option', c.id AS 'id' FROM category AS c JOIN product AS p ON p.category_id = c.id GROUP BY c.name ORDER BY COUNT(*) DESC;",
|
||||
'list_prod': "SELECT p.name, p.nutrition_grades AS 'option', p.id AS 'id' FROM product AS p LEFT JOIN category AS c ON p.category_id = c.id WHERE c.id = '{}' AND p.nutrition_grades IS NOT NULL;",
|
||||
'list_prod': "SELECT p.name, p.nutrition_grades AS 'option', p.id AS 'id' FROM product AS p LEFT JOIN category AS c ON p.category_id = c.id WHERE c.id = '{}' AND p.nutrition_grades IS NOT NULL AND p.substitute_id IS NULL;",
|
||||
'list_substitute': "SELECT p.name, p.nutrition_grades AS 'option', p.id AS 'id' FROM product AS p LEFT JOIN category AS c ON p.category_id = c.id WHERE c.id = '{}' AND p.nutrition_grades < '{}'",
|
||||
'select_substitute': "SELECT p.*, c.name FROM product AS p LEFT JOIN category AS c ON p.category_id = c.id WHERE p.id = '{}'",
|
||||
'save_substitute': "UPDATE product SET substitute_id={} WHERE id={}",
|
||||
|
|
Loading…
Reference in New Issue