Info texts. Min Max Punkte werden jetzt richitg angewandt im Match-Formular.
This commit is contained in:
parent
8aab21eb59
commit
b861ebf79d
|
|
@ -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"}
|
||||
{"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"}
|
||||
|
|
@ -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"}
|
||||
|
|
@ -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"}
|
||||
{}
|
||||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user