From e5fa7942c72367c46bf455018cf2ee02d4e0346b Mon Sep 17 00:00:00 2001 From: Lunaresk Date: Sat, 4 Dec 2021 11:06:05 +0100 Subject: [PATCH] fix: fix some inconsistencies --- client/src/connection.py | 4 ++-- client/src/main.py | 10 +++++----- server/src/main.py | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/src/connection.py b/client/src/connection.py index caa1927..bcb18d2 100644 --- a/client/src/connection.py +++ b/client/src/connection.py @@ -32,8 +32,8 @@ def check_login(login: str) -> bool: return False -def send_scan(login: str, scanned: dict[int: int], date:str = None): - infos = {'login': login, 'items': scanned} +def send_scan(user: str, scanned: dict[int: int], date:str = None): + infos = {'user': user, 'items': scanned} if date: infos['date'] = date try: diff --git a/client/src/main.py b/client/src/main.py index 076e925..a503667 100644 --- a/client/src/main.py +++ b/client/src/main.py @@ -30,22 +30,22 @@ TIMEOUT = 60 # Number of seconds for a timeout after being logged in def main() -> None: while True: - login = input("Enter Login: ") - if login == "quit": + user = input("Enter Login: ") + if user == "quit": break - if not connection.check_login(login): + if not connection.check_login(user): LOGGER.debug("Login failed") continue # Send Error that login wasn't possible LOGGER.debug("Login successful") scanned = scanning() scanned = group_scanning(scanned) - result = connection.send_scan(login, scanned) + result = connection.send_scan(user, scanned) if result != True: result['date'] = str(date.today()) TEMP.append(result) if TEMP: for bought in TEMP: - result = connection.send_scan(bought['login'], bought['items'], bought['date']) + result = connection.send_scan(bought['user'], bought['items'], bought['date']) TEMP.remove(bought) if result != True: TEMP.append(result) diff --git a/server/src/main.py b/server/src/main.py index 86035e0..2f33f88 100644 --- a/server/src/main.py +++ b/server/src/main.py @@ -40,13 +40,13 @@ def login(): @app.route('/scan2kasse/insert', methods=['POST']) def insert(): match request.json: - case {'login': login, 'items': items, 'date': date}: - failed = DATABASE.insert_bought_items(login, items, date) + case {'user': user, 'items': items, 'date': date}: + failed = DATABASE.insert_bought_items(user, items, date) if failed: return jsonify(failed), 400 return jsonify({'inserted': True}), 201 - case {'login': login, 'items': items}: - failed = DATABASE.insert_bought_items(login, items) + case {'user': user, 'items': items}: + failed = DATABASE.insert_bought_items(user, items) if failed: return jsonify(failed), 400 return jsonify({'inserted': True}), 201