diff --git a/.nicegui/storage-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json b/.nicegui/storage-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json index 768c8da..6c3d053 100644 --- a/.nicegui/storage-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json +++ b/.nicegui/storage-user-21d6fdd4-43d2-4625-8dc2-9282b6aa433f.json @@ -1 +1 @@ -{"authenticated":true,"discord_id":"277898241750859776","discord_name":"mrteels","db_id":2,"display_name":"Verwirrter Klebschnüffler","discord_avatar_url":"https://cdn.discordapp.com/avatars/277898241750859776/7c3446bb51fafd72b1b4c21124b4994f.png"} \ No newline at end of file +{"authenticated":true,"discord_id":"277898241750859776","discord_name":"mrteels","db_id":2,"display_name":"Verzweifelter Kultist","discord_avatar_url":"https://cdn.discordapp.com/avatars/277898241750859776/7c3446bb51fafd72b1b4c21124b4994f.png"} \ No newline at end of file diff --git a/.nicegui/storage-user-253576f7-9827-4994-a103-e67a11c8053c.json b/.nicegui/storage-user-253576f7-9827-4994-a103-e67a11c8053c.json new file mode 100644 index 0000000..6c3d053 --- /dev/null +++ b/.nicegui/storage-user-253576f7-9827-4994-a103-e67a11c8053c.json @@ -0,0 +1 @@ +{"authenticated":true,"discord_id":"277898241750859776","discord_name":"mrteels","db_id":2,"display_name":"Verzweifelter Kultist","discord_avatar_url":"https://cdn.discordapp.com/avatars/277898241750859776/7c3446bb51fafd72b1b4c21124b4994f.png"} \ No newline at end of file diff --git a/.nicegui/storage-user-62e9c394-87c8-4ee0-a57f-d66ec22cd26a.json b/.nicegui/storage-user-62e9c394-87c8-4ee0-a57f-d66ec22cd26a.json index 8a8a4ed..9e26dfe 100644 --- a/.nicegui/storage-user-62e9c394-87c8-4ee0-a57f-d66ec22cd26a.json +++ b/.nicegui/storage-user-62e9c394-87c8-4ee0-a57f-d66ec22cd26a.json @@ -1 +1 @@ -{"authenticated":true,"discord_id":"159672532159561728","discord_name":"buddyl33t","db_id":3,"display_name":"Marian","discord_avatar_url":"https://cdn.discordapp.com/avatars/159672532159561728/866d0dddade9d551f3c5025bb6467da0.png"} \ No newline at end of file +{} \ No newline at end of file diff --git a/gui/info_text/info_system.py b/gui/info_text/info_system.py index df52357..b584714 100644 --- a/gui/info_text/info_system.py +++ b/gui/info_text/info_system.py @@ -28,7 +28,7 @@ def create_info_button(topic_key): with ui.dialog().classes("w-full items-center") as info_dialog, ui.card().classes("items-center text-textnormal"): # Loopen durch die Sätze in der JSON for sentence in texts: - ui.markdown(sentence).classes("font-bold text-white text-lg text-center") + ui.markdown(sentence).classes("text-normaltext text-lg text-center") # --- DER BUTTON (Sichtbar auf der Seite) --- ui.button(icon="info_outline", color= "", on_click=info_dialog.open).props('round dense') diff --git a/gui/match_gui.py b/gui/match_gui.py index d4a91eb..552c84a 100644 --- a/gui/match_gui.py +++ b/gui/match_gui.py @@ -7,8 +7,8 @@ from gui.info_text import info_system def setup_routes(): # 1. Die {}-Klammern definieren eine dynamische Variable in der URL - @ui.page('/add-match/{systemname}', dark=True) - def match_form_page(systemname: str): # <--- WICHTIG: Hier fangen wir das Wort aus der URL auf! + @ui.page('/add-match/{system_name}', dark=True) + def match_form_page(system_name: str): # <--- WICHTIG: Hier fangen wir das Wort aus der URL auf! gui_style.apply_design() # --- SICHERHEITS-CHECK --- @@ -17,16 +17,21 @@ def setup_routes(): ui.button('Back to Home', on_click=lambda: ui.navigate.to('/')) return - # ÄNDERUNG: w-full (für Handy) + max-w-md (für PC) + mx-auto (Zentrieren) + p-6 (Innenabstand) + # --- Eingabeformular --- with ui.card().classes('w-full max-w-md mx-auto items-center mt-10 p-6 shadow-xl'): + system_id = data_api.get_gamesystem_id_by_name(system_name) + system_data = data_api.get_gamesystem_data(system_id) + min_score = system_data["min_score"] + max_score = system_data["max_score"] + # Text-Center hinzugefügt, falls der Systemname sehr lang ist und auf dem Handy umbricht - ui.label(f'Neues Spiel für {systemname} eintragen').classes('text-2xl font-bold text-center mb-6') + ui.label(f'Neues Spiel für {system_name} eintragen').classes('text-2xl font-bold text-center mb-6') ui.label("Meine Punkte:").classes('text-xl font-bold w-full text-left') with ui.column().classes("w-full items-center gap-6"): # 1. Daten aus der DB holen - raw_players = data_api.get_all_players_from_system(systemname) + raw_players = data_api.get_all_players_from_system(system_name) my_id = app.storage.user.get('db_id') dropdown_options = {} @@ -36,16 +41,15 @@ def setup_routes(): dropdown_options[p['player_id']] = f"{p['display_name']} 'aka' {p['discord_name']}" with ui.row().classes("w-full items-center justify-between"): - p1_points = ui.slider(min=0, max=100, value=10).classes("w-70") + p1_points = ui.slider(min=min_score, max=max_score, value=10).classes("w-70") ui.label().bind_text_from(p1_points, 'value').classes("text-lg text-normaltext") ui.separator().classes('w-full mt-4') # Ein schöner Trennstrich für die Optik - ui.label("Gegner:").classes('text-xl font-bold w-full text-left') opponent_select = ui.select(options=dropdown_options, label='Gegner auswählen').classes('w-full') with ui.row().classes("w-full items-center justify-between"): - p2_points = ui.slider(min=0, max=100, value=10).classes("w-70") + p2_points = ui.slider(min=min_score, max=max_score, value=10).classes("w-70") ui.label().bind_text_from(p2_points, 'value').classes("text-lg text-normaltext") ui.space() @@ -60,14 +64,14 @@ def setup_routes(): score_p1 = p1_points.value score_p2 = p2_points.value - match_id = data_api.add_new_match(systemname, my_id, p2_id, score_p1, score_p2) + match_id = data_api.add_new_match(system_name, my_id, p2_id, score_p1, score_p2) # 4. Erfolgsmeldung und Berechnung ui.notify("Match erfolgreich eingetragen!", color="green") - ui.navigate.to(f'/statistic/{systemname}') + ui.navigate.to(f'/statistic/{system_name}') # Buttons ganz unten in einer Reihe with ui.row().classes("w-full items-center justify-between mt-8"): - ui.button(icon="close", on_click=lambda: ui.navigate.to(f'/statistic/{systemname}')).classes("w-10 h-8 rounded-full") + ui.button(icon="close", on_click=lambda: ui.navigate.to(f'/statistic/{system_name}')).classes("w-10 h-8 rounded-full") info_system.create_info_button("match_form_info") ui.button(text="Absenden", color="positive", on_click=lambda: input_match_to_database()) diff --git a/match_calculations/calc_match.py b/match_calculations/calc_match.py index 1c92452..1a42ab4 100644 --- a/match_calculations/calc_match.py +++ b/match_calculations/calc_match.py @@ -5,7 +5,7 @@ import os from wood import logger -point_inflation = 0.8 # => entspricht % +point_inflation = 1 # => entspricht % K_FACTOR = 40 # Die "Border" (Maximalpunkte) die ein Sieg gibt. # Mach die DB abfrage für die Relevanten Daten. Von hier aus werden die "Aufgaben" und Daten dann an die kleineren Berechnungs Funktionen verteilt.