22.03.2022
This commit is contained in:
parent
d4dee206e2
commit
5d4c14043d
|
@ -11,4 +11,5 @@ Ziel ist es ein Programm mit einer Datenbank zu erstellen, welches:
|
|||
<blockquote>
|
||||
Du kannst die start_app.py in einer IDE starten
|
||||
oder in der Konsole unter Windows "py main.py" ausführen
|
||||
|
||||
</blockquote >
|
|
@ -5,5 +5,4 @@
|
|||
user = 'root'
|
||||
password = ''
|
||||
host = 'localhost'
|
||||
|
||||
json_file = 'questions_answers.json'
|
|
@ -66,3 +66,7 @@ def show_tables(db_cursor):
|
|||
db_cursor.execute(query)
|
||||
except mysql.connector.Error as err:
|
||||
print('Something went wrong', err)
|
||||
|
||||
|
||||
def show(cursor, use_type):
|
||||
return None
|
|
@ -1,4 +1,6 @@
|
|||
import mysql.connector
|
||||
|
||||
|
||||
# Aufbau der verbindung zum Mysql Server
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import database
|
||||
from database import *
|
||||
import database_connection
|
||||
import config
|
||||
import main_menu
|
||||
|
|
|
@ -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'}
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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": " "
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
]
|
|
@ -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'])
|
||||
|
|
12
start.bat
12
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
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
|
||||
|
||||
# Startet das Programm in der Windows Konsole
|
||||
os.system("start /wait cmd /c py main.py")
|
||||
|
|
Loading…
Reference in New Issue
Block a user