diff --git a/README.md b/README.md index f9badbd..ab6eb0e 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,5 @@ Ziel ist es ein Programm mit einer Datenbank zu erstellen, welches:
Du kannst die start_app.py in einer IDE starten oder in der Konsole unter Windows "py main.py" ausführen +
\ No newline at end of file diff --git a/main.py b/app.py similarity index 100% rename from main.py rename to app.py diff --git a/config.py b/config.py index 277b18a..4d4efb6 100644 --- a/config.py +++ b/config.py @@ -5,5 +5,4 @@ user = 'root' password = '' host = 'localhost' - json_file = 'questions_answers.json' \ No newline at end of file diff --git a/database.py b/database.py index 6899a9b..7c57796 100644 --- a/database.py +++ b/database.py @@ -65,4 +65,8 @@ def show_tables(db_cursor): try: db_cursor.execute(query) except mysql.connector.Error as err: - print('Something went wrong', err) \ No newline at end of file + print('Something went wrong', err) + + +def show(cursor, use_type): + return None \ No newline at end of file diff --git a/database_connection.py b/database_connection.py index 491db33..d361475 100644 --- a/database_connection.py +++ b/database_connection.py @@ -1,4 +1,6 @@ import mysql.connector + + # Aufbau der verbindung zum Mysql Server @@ -10,4 +12,4 @@ def db_connection(user, password, host, database): except mysql.connector.Error as err: print('Something went wrong', err) print('Veruche deinen Mysql Server neu zu starten') - return connection \ No newline at end of file + return connection diff --git a/database_menu.py b/database_menu.py index bf635df..6055343 100644 --- a/database_menu.py +++ b/database_menu.py @@ -1,4 +1,5 @@ import database +from database import * import database_connection import config import main_menu diff --git a/main_menu.py b/main_menu.py index 1059cb0..6f864c3 100644 --- a/main_menu.py +++ b/main_menu.py @@ -4,7 +4,6 @@ import question_answer_output # Main Menu - def main_menu(): enable_menu = True selection = {0: 'Datenbank Menü', 1: 'Zufallsfrage', 2: 'Programm beenden\n'} diff --git a/question_answer_output.py b/question_answer_output.py index 99772f7..4c861af 100644 --- a/question_answer_output.py +++ b/question_answer_output.py @@ -11,9 +11,9 @@ def read_json(filename): # Zufällige Frage erstellen def random_question(filename): - min = 0 - max = len(read_json(filename)) - random_number = randrange(min,max) + min_ = 0 + max_ = len(read_json(filename)) + random_number = randrange(min_,max_) questions = read_json(filename) question = f'Frage #{random_number}: ' + questions[random_number][str(random_number)]['question'] answer = questions[random_number][str(random_number)]['answer'] diff --git a/questions_answers.json b/questions_answers.json index bfc8cc2..b5483fe 100644 --- a/questions_answers.json +++ b/questions_answers.json @@ -2,9 +2,68 @@ { "0": { "question": "Was versteht man unter dem Begriff Cross-Selling?", - "answer": "Eine Verkaufsstrategie, bei der zu einem Produkt, zusätzliche ( Inhalte, Produkte, Services etc...) angeboten werden, um einen höheren Umsatz und höhere Kundenanbindung zu erzielen" + "answer": "Eine Verkaufsstrategie, bei der zu einem Produkt, zusätzliche ( inhalte, produkte, services etc...) angeboten werden, um einen höheren Umsatz und die Kundenanbindung zu erhöhen" + } + }, + { + "1": { + "question": "", + "answer": "" + } + }, + { + "2": { + "question": " ", + "answer": " " + } + }, + { + "3": { + "question": "", + "answer": "" + } + }, + { + "4": { + "question": " ", + "answer": " " + } + }, + { + "5": { + "question": " ", + "answer": " " + } + }, + { + "6": { + "question": " ", + "answer": " " + } + }, + { + "7": { + "question": " ", + "answer": " " + } + }, + { + "8": { + "question": " ", + "answer": " " + } + }, + { + "9": { + "question": " ", + "answer": " " + } + }, + { + "10": { + "question": " ", + "answer": " " } - } ] \ No newline at end of file diff --git a/requirements_installer.py b/requirements_installer.py index 0dd1862..57d1471 100644 --- a/requirements_installer.py +++ b/requirements_installer.py @@ -2,7 +2,7 @@ import sys import subprocess -# Ressourcen für den Autoinstall +# Ressourcen für den Autoinstaller def installer(): subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'mysql-connector-python']) diff --git a/start.bat b/start.bat index b785332..4cc1a81 100644 --- a/start.bat +++ b/start.bat @@ -1,7 +1,11 @@ @echo off -echo Autor : Marcus Ferl -echo Beschreibung : IHK Prüfungsfragen -echo Programm gestartet -@py.exe main.py +chcp 65001 +echo ##################################### +echo # Autor : Marcus Ferl # +echo # Beschreibung : IHK Prüfungsfragen # +echo # Programm gestartet # +echo ##################################### +echo +@py.exe app.py pause \ No newline at end of file diff --git a/start_app.py b/start_app.py index ad71ee9..b6c3485 100644 --- a/start_app.py +++ b/start_app.py @@ -1,4 +1,5 @@ import os + # Startet das Programm in der Windows Konsole os.system("start /wait cmd /c py main.py")