Compare commits
26 Commits
42c60f9db5
...
ScraperTes
| Author | SHA1 | Date | |
|---|---|---|---|
| c86a93c153 | |||
| 43eb1d421d | |||
| c2568c86ef | |||
| cf46fdfbb7 | |||
| 791d20139d | |||
| c3a6626d6f | |||
| 5960e44b17 | |||
| 919d64ca5e | |||
| 2cfa5f1fa4 | |||
| 9b45a3f26f | |||
| 3dfc40cdb0 | |||
|
|
13f6e2e3b9 | ||
|
|
9a007f504c | ||
|
|
b5fdbb3230 | ||
| be951d296f | |||
| 6e1e8ccc7d | |||
| 03463905ef | |||
| 35db71b8cc | |||
| f65a174089 | |||
| bdfa31c8ea | |||
| 206f7d6fb3 | |||
| df0e47c610 | |||
| 3b9aa8150b | |||
| bc557b35af | |||
| 4987dc4cf7 | |||
| 48825185b8 |
@@ -1,9 +1,11 @@
|
||||
from flask import session
|
||||
from lewy_db import baza as ldb
|
||||
from lewy_globals import colors as c
|
||||
import json
|
||||
import lewy_globals
|
||||
import requests
|
||||
import time
|
||||
from sqlalchemy import func
|
||||
|
||||
def safe_traverse(obj: dict, path: list, default=None):
|
||||
result = obj
|
||||
@@ -12,7 +14,7 @@ def safe_traverse(obj: dict, path: list, default=None):
|
||||
result = result[x]
|
||||
except KeyError:
|
||||
result = default
|
||||
# print(f"error reading: {' -> '.join(path)} - returning: {default}")
|
||||
print(f"safe_traverse: error reading {' -> '.join(path)} - returning: {default}")
|
||||
finally:
|
||||
return result
|
||||
|
||||
@@ -45,6 +47,17 @@ class scraper:
|
||||
else:
|
||||
return False
|
||||
|
||||
def to_iso_compatible_date(self, dmy_date: str):
|
||||
"""
|
||||
Zamienia datę z formatu DD.MM.YY na YYYY-MM-DD
|
||||
|
||||
:param dmy_date: Data w formacie DD.MM.YY
|
||||
:type dmy_date: str
|
||||
"""
|
||||
day, month, year = dmy_date.split(".")
|
||||
return f"{2000 + int(year)}-{month}-{day}"
|
||||
|
||||
|
||||
def czy_mecz_istnieje(self, zewnetrzne_id_meczu: str):
|
||||
# mecz = db.simple_select_all(ldb.mecze, zewnetrzne_id_meczu=zewnetrzne_id_meczu)
|
||||
# if mecz is not None and mecz != []:
|
||||
@@ -61,6 +74,34 @@ class scraper:
|
||||
# return False
|
||||
return self.__czy_x_istnieje("kluby", id_klubu=id_klubu)
|
||||
|
||||
def id_na_imie_nazwisko_urodziny(self, zewnetrzne_id_sportowca: str = "MVC8zHZD"):
|
||||
"""
|
||||
Scraper z dykty xD
|
||||
Pobiera imiona, nazwiska i dni urodzin sportowców z zewnętrznego id.
|
||||
Działa na słowo honoru.
|
||||
|
||||
:param zewnetrzne_id_sportowca: Zewnętrzne id sportowca
|
||||
:type zewnetrzne_id_sportowca: str
|
||||
"""
|
||||
if len(zewnetrzne_id_sportowca) != 8:
|
||||
raise ValueError("Zewnętrzne ID sportowca powinno być długości 8!")
|
||||
r = requests.get(f'https://www.flashscore.pl/?r=4:{zewnetrzne_id_sportowca}')
|
||||
page = r.text
|
||||
|
||||
name_start_pos = page.find("data-testid=\"wcl-scores-heading-02\">") + 36
|
||||
name_end_pos = page.find("</", name_start_pos)
|
||||
name = page[name_start_pos:name_end_pos].strip().split(' ')
|
||||
|
||||
# Tak wiem... można by było użyć beautifulsoup4, ale nie ma sensu dodawać nowych zależności dla tylko jednej metody.
|
||||
birthday_start_pos_1 = page.find("data-testid=\"wcl-scores-simpleText-01\">", name_end_pos) + 39
|
||||
birthday_start_pos_2 = page.find("data-testid=\"wcl-scores-simpleText-01\">", birthday_start_pos_1) + 39
|
||||
birthday_start_pos_3 = page.find("data-testid=\"wcl-scores-simpleText-01\">", birthday_start_pos_2) + 39
|
||||
birthday_start_pos = page.find("data-testid=\"wcl-scores-simpleText-01\">", birthday_start_pos_3) + 39
|
||||
birthday_end_pos = page.find("</", birthday_start_pos) - 1
|
||||
birthday = None if birthday_end_pos - birthday_start_pos > 20 else page[birthday_start_pos:birthday_end_pos].strip(" ()")
|
||||
|
||||
return name, birthday
|
||||
|
||||
def aktualizuj_dane_sportowca(self, zewnetrzne_id_sportowca: str = "MVC8zHZD"):
|
||||
stop_scraping = False
|
||||
matches_to_add = []
|
||||
@@ -69,6 +110,9 @@ class scraper:
|
||||
# Jeśli nie, dodaj go w podobny sposób, jak
|
||||
# w sample_data_init() (w lewy_db.py).
|
||||
|
||||
id_zawodnika = self.db.get_id_zawodnika_by_zewnetrzne_id(zewnetrzne_id_sportowca)
|
||||
zawodnik = self.db.simple_select_all("sportowcy", zewnetrzne_id_zawodnika=zewnetrzne_id_sportowca)[0]
|
||||
|
||||
page = 0
|
||||
match_num = 0
|
||||
while not stop_scraping:
|
||||
@@ -113,8 +157,88 @@ class scraper:
|
||||
|
||||
# TODO: dodaj obiekt mecz do bazy (simple_insert_one(), simple_insert_many())
|
||||
print(f"{c.OKCYAN}Nowy mecz ({match_num}){c.ENDC}: {match}")
|
||||
|
||||
iso_converted_date = self.to_iso_compatible_date(safe_traverse(match, ["eventStartTime"], default="1970-01-01"))
|
||||
|
||||
self.db.simple_insert_one("mecze",
|
||||
zewnetrzne_id_meczu = safe_traverse(match, ["eventEncodedId"], default=""),
|
||||
data = iso_converted_date,
|
||||
gospodarze_id = home_club_id,
|
||||
gospodarze = self.db.simple_select_all("kluby", id_klubu=home_club_id)[0],
|
||||
goscie_id = away_club_id,
|
||||
goscie = self.db.simple_select_all("kluby", id_klubu=away_club_id)[0],
|
||||
gosp_wynik = safe_traverse(match, ["homeScore"], default=0),
|
||||
gosc_wynik = safe_traverse(match, ["awayScore"], default=0),
|
||||
sezon = safe_traverse(match, ["tournamentSeason"], default=""),
|
||||
nazwa_turnieju = safe_traverse(match, ["tournamentTitle"], default=""),
|
||||
skrocona_nazwa_turnieju = safe_traverse(match, ["tournamentTemplateShortCode"], default=""),
|
||||
flaga = safe_traverse(match, ["flagId"], default=0),
|
||||
)
|
||||
match_num += 1
|
||||
|
||||
stats = safe_traverse(match, ["stats"], default="")
|
||||
zewnetrzne_id_meczu = safe_traverse(match, ["eventEncodedId"], default="")
|
||||
|
||||
if stats != False: # gdy sportowiec był aktywny w meczu
|
||||
print("todo :)")
|
||||
# # TODO:
|
||||
# self.db.simple_insert_one("sportowcy_w_meczach",
|
||||
# id_zawodnika = id_zawodnika,
|
||||
# zawodnik = zawodnik,
|
||||
# zewnetrzne_id_meczu = zewnetrzne_id_meczu,
|
||||
# # ODTĄD SIĘ NIE POKRYWA!!! POLA POWINNY SIĘ ZGADZAĆ Z TYM, CO JEST W LEWY_DB (konkretnie klasie sportowcy_w_meczach)
|
||||
# ostatni_mecz = self.db.get_id_meczu_by_zewnetrzne_id(zewnetrzne_id_meczu),
|
||||
# ilosc_wystapien = 1 if int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")) > 0 else 0,
|
||||
# minut_gry = int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")),
|
||||
# gier_sum = 1 if int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")) > 0 else 0,
|
||||
# goli_sum = int(safe_traverse(stats, ["596", "value"], default="0")),
|
||||
# asyst_sum = int(safe_traverse(stats, ["541", "value"], default="0")),
|
||||
# interwencji_sum = 0,
|
||||
# nieobronionych_interwencji_sum = 0,
|
||||
# zoltych_kartek_sum = int(safe_traverse(stats, ["599", "value"], default="0")),
|
||||
# czerwonych_kartek_sum = int(safe_traverse(stats, ["600", "value"], default="0")),
|
||||
# wygranych_sum = 1 if safe_traverse(match, ["winLoseShort"], default="") == "Z" else 0,
|
||||
# wynik_sum = safe_traverse(match, ["rating"], default=0),
|
||||
# meczow_do_wynikow_sum = 1 if safe_traverse(match, ["rating"], default=0) not in (0, None) else None
|
||||
# )
|
||||
|
||||
# # analogicznie zinkrementuj statystyki_sportowcow:
|
||||
# # UWAGA! NIE ZADZIAŁA DLA NIKOGO INNEGO, NIŻ ROBERCIKA (bo nie mamy innych sportowców w bazie, trzeba dodać ich ręcznie w lewy_db sample_data_init())
|
||||
# self.db.simple_insert_one("statystyki_sportowcow",
|
||||
# sportowiec = zawodnik,
|
||||
# ostatni_mecz = self.db.get_id_meczu_by_zewnetrzne_id(zewnetrzne_id_meczu),
|
||||
# ilosc_wystapien = 1 if int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")) > 0 else 0,
|
||||
# minut_gry = int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")),
|
||||
# gier_sum = 1 if int(safe_traverse(stats, ["595", "value"], default="0").rstrip("'")) > 0 else 0,
|
||||
# goli_sum = int(safe_traverse(stats, ["596", "value"], default="0")),
|
||||
# asyst_sum = int(safe_traverse(stats, ["541", "value"], default="0")),
|
||||
# interwencji_sum = 0,
|
||||
# nieobronionych_interwencji_sum = 0,
|
||||
# zoltych_kartek_sum = int(safe_traverse(stats, ["599", "value"], default="0")),
|
||||
# czerwonych_kartek_sum = int(safe_traverse(stats, ["600", "value"], default="0")),
|
||||
# wygranych_sum = 1 if safe_traverse(match, ["winLoseShort"], default="") == "Z" else 0,
|
||||
# wynik_sum = safe_traverse(match, ["rating"], default=0),
|
||||
# meczow_do_wynikow_sum = 1 if safe_traverse(match, ["rating"], default=0) not in (0, None) else None
|
||||
# )
|
||||
|
||||
else:
|
||||
print("też todo :)")
|
||||
# # TODO: TU TEŻ TRZEBA POPRAWIĆ ANALOGICZNIE DO TEGO, CO JEST WEWNĄTRZ IF'A
|
||||
# self.db.simple_insert_one("sportowcy_w_meczach", id_zawodnika,
|
||||
# ostatni_mecz = self.db.get_id_meczu_by_zewnetrzne_id(zewnetrzne_id_meczu),
|
||||
# ilosc_wystapien = 0,
|
||||
# minut_gry = 0,
|
||||
# gier_sum = 0,
|
||||
# goli_sum = 0,
|
||||
# asyst_sum = 0,
|
||||
# interwencji_sum = 0,
|
||||
# nieobronionych_interwencji_sum = 0,
|
||||
# zoltych_kartek_sum = 0,
|
||||
# czerwonych_kartek_sum = 0,
|
||||
# wygranych_sum = 1 if safe_traverse(match, ["winLoseShort"], default="") == "Z" else 0,
|
||||
# wynik_sum = safe_traverse(match, ["rating"], default=0),
|
||||
# meczow_do_wynikow_sum = 1 if safe_traverse(match, ["rating"], default=0) not in (0, None) else None
|
||||
# )
|
||||
|
||||
# TODO: Zaktualizuj statystyki sportowca
|
||||
|
||||
@@ -127,7 +251,7 @@ class scraper:
|
||||
# rate limita. - sherl
|
||||
|
||||
page += 1
|
||||
time.sleep(15)
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
def aktualizuj_dane(self):
|
||||
|
||||
@@ -58,6 +58,8 @@ def setup():
|
||||
sanity_string += f" If you're running a reverse proxy, set {c.OKCYAN}is_proxied{c.ENDC} to true to silence this message.\n"
|
||||
print(sanity_string)
|
||||
|
||||
# Should fix disconnects: https://stackoverflow.com/a/61739721
|
||||
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {"pool_pre_ping": True}
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = f"{config['general']['db_path_url']}"
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
@@ -67,6 +69,10 @@ def setup():
|
||||
app.add_url_rule('/mecze', view_func=lewy_routes.mecze)
|
||||
app.add_url_rule('/statystyki', view_func=lewy_routes.statystyki)
|
||||
app.add_url_rule('/toggle_dark_mode', view_func=lewy_routes.toggle_dark_mode)
|
||||
app.add_url_rule('/club', view_func=lewy_routes.clubs)
|
||||
app.add_url_rule('/representation', view_func=lewy_routes.representation)
|
||||
app.add_url_rule('/compare', view_func=lewy_routes.compare)
|
||||
app.add_url_rule('/trophies', view_func=lewy_routes.trophies)
|
||||
|
||||
# API:
|
||||
app.add_url_rule('/api/', view_func=lewy_api.api_greeting)
|
||||
|
||||
@@ -89,7 +89,12 @@ def get_matches(r):
|
||||
"""
|
||||
TODO: Zwraca mecze.
|
||||
"""
|
||||
pass
|
||||
response_json = []
|
||||
mecze = getDb().simple_select_all("mecze")
|
||||
for mecz in mecze:
|
||||
response_json.append(mecz.jsonify())
|
||||
print(response_json)
|
||||
return 200, "ok", response_json
|
||||
|
||||
# GET /api/v1/debugger_halt?token=XXX...
|
||||
@require_authentication
|
||||
@@ -105,6 +110,20 @@ def debugger_halt(r):
|
||||
breakpoint()
|
||||
return 200, "ok", []
|
||||
|
||||
def last_goal_for(sportowiec: str = "MVC8zHZD"):
|
||||
"""
|
||||
Pobierz klub, dla którego sportowiec (domyślnie Robert) oddał ostatni gol.
|
||||
|
||||
:returns: Klub, lub None
|
||||
:rtype: kluby | None
|
||||
"""
|
||||
|
||||
sportowiec = getDb().simple_select_all("sportowcy", zewnetrzne_id_zawodnika=sportowiec)
|
||||
if sportowiec != []:
|
||||
return sportowiec[0].ostatni_gol_dla
|
||||
|
||||
return None
|
||||
|
||||
def lookup(data, request):
|
||||
"""
|
||||
Obsługuje zapytania zwrócone do /api/v1/...
|
||||
@@ -128,7 +147,7 @@ def lookup(data, request):
|
||||
case 'halt':
|
||||
return debugger_halt(r = request)
|
||||
case 'matches':
|
||||
get_matches(r = request)
|
||||
return get_matches(r = request)
|
||||
case _:
|
||||
increment_bad_requests()
|
||||
return not_implemented(data)
|
||||
@@ -6,9 +6,22 @@ from sqlalchemy.orm import Mapped, mapped_column, DeclarativeBase, Session, rela
|
||||
from typing import List
|
||||
import time
|
||||
import toml
|
||||
import traceback
|
||||
|
||||
global db
|
||||
|
||||
class c:
|
||||
HEADER = '\033[95m'
|
||||
OKBLUE = '\033[94m'
|
||||
OKCYAN = '\033[96m'
|
||||
OKGREEN = '\033[92m'
|
||||
WARNING = '\033[93m'
|
||||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
BOLD = '\033[1m'
|
||||
UNDERLINE = '\033[4m'
|
||||
ENDL = '\n'
|
||||
|
||||
class baza():
|
||||
|
||||
# global sportowcy, trofea, sportowcy_w_meczach, statystyki_sportowcow, kluby, mecze
|
||||
@@ -23,6 +36,9 @@ class baza():
|
||||
self.db = self.initDB(self.app, config)
|
||||
self.refresh_session()
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Obiekt bazodanowy baza ({len(self.entities)} encji)>"
|
||||
|
||||
def initDB(self, app, config):
|
||||
global sportowcy, trofea, sportowcy_w_meczach, statystyki_sportowcow, kluby, mecze
|
||||
tnp = config['general']['db_prefix'] + "_lewangoalski_"
|
||||
@@ -106,6 +122,8 @@ class baza():
|
||||
zoltych_kartek_sum: Mapped[ int] = mapped_column()
|
||||
czerwonych_kartek_sum: Mapped[ int] = mapped_column()
|
||||
wygranych_sum: Mapped[ int] = mapped_column()
|
||||
przegranych_sum: Mapped[ int] = mapped_column()
|
||||
remisow_sum: Mapped[ int] = mapped_column()
|
||||
wynik_sum: Mapped[ int] = mapped_column()
|
||||
meczow_do_wynikow_sum: Mapped[ int] = mapped_column()
|
||||
|
||||
@@ -142,6 +160,23 @@ class baza():
|
||||
def __repr__(self):
|
||||
return f"<Mecz #{self.id_meczu} ({self.zewnetrzne_id_meczu}, {self.gospodarze.skrocona_nazwa} vs. {self.goscie.skrocona_nazwa})>"
|
||||
|
||||
def jsonify(self):
|
||||
return {
|
||||
"id_meczu": self.id_meczu,
|
||||
"zewnetrzne_id_meczu": self.zewnetrzne_id_meczu,
|
||||
"data": self.data.strftime("%Y-%m-%d"),
|
||||
"gospodarze_id": self.gospodarze_id,
|
||||
"gospodarze": self.gospodarze.skrocona_nazwa,
|
||||
"goscie_id": self.goscie_id,
|
||||
"goscie": self.goscie.skrocona_nazwa,
|
||||
"gosp_wynik": self.gosp_wynik,
|
||||
"gosc_wynik": self.gosc_wynik,
|
||||
"sezon": self.sezon,
|
||||
"nazwa_turnieju": self.nazwa_turnieju,
|
||||
"skrocona_nazwa_turnieju": self.skrocona_nazwa_turnieju,
|
||||
"flaga": self.flaga
|
||||
}
|
||||
|
||||
self.entities = {
|
||||
'sportowcy': sportowcy,
|
||||
'trofea': trofea,
|
||||
@@ -167,18 +202,42 @@ class baza():
|
||||
try:
|
||||
return_val = func(self, *args, **kwargs)
|
||||
except:
|
||||
print(f"{c.FAIL}"
|
||||
f"Wystąpił błąd podczas wykonywania zapytania SQL:"
|
||||
f"{c.ENDC}"
|
||||
"\n"
|
||||
f"{traceback.format_exc()}")
|
||||
self.session.rollback()
|
||||
self.session.close()
|
||||
self.refresh_session()
|
||||
return return_val
|
||||
return wrapper
|
||||
|
||||
def str_to_column(self, string: str):
|
||||
"""
|
||||
Zamienia tekstowy zapis "tabela.kolumna"
|
||||
na obiekt modelu bazy (ze zmiennej self.entities).
|
||||
Zwraca None jeśli takowego nie znajdzie.
|
||||
Zamiennik dla niepożądanego eval().
|
||||
|
||||
:param string: Zapis tekstowy
|
||||
:type string: str
|
||||
"""
|
||||
try:
|
||||
table_str, column_str = string.split('.')
|
||||
except:
|
||||
raise ValueError("Nieprawidłowe dane - podaj zarówno tabelę, jak i kolumnę, np.: \"kluby.id_klubu\".")
|
||||
if hasattr(self.entities[table_str], column_str):
|
||||
return getattr(self.entities[table_str], column_str)
|
||||
return None
|
||||
|
||||
@exit_gracefully
|
||||
def simple_select_all(self, entity_type, **kwargs):
|
||||
"""
|
||||
Użycie:
|
||||
simple_select_all(ldb.sportowcy, zewnetrzne_id_zawodnika="MVC8zHZD")
|
||||
simple_select_all("sportowcy", id_zawodnika=1)
|
||||
simple_select_all("kluby", ..., LIMIT=5, ORDER_BY="kluby.skrocona_nazwa")
|
||||
|
||||
https://stackoverflow.com/a/75316945
|
||||
Did they make it harder to query dynamically on purpose? ~Frank 19.11.2023
|
||||
@@ -187,16 +246,73 @@ class baza():
|
||||
if not isinstance(entity_type, str):
|
||||
entity_type = entity_type.__name__
|
||||
|
||||
print(f"[{round(time.time())}] SELECT")
|
||||
query_params, special_args = self.extract_special_args(kwargs)
|
||||
|
||||
print(f"[{round(time.time())}] SELECT {entity_type}")
|
||||
|
||||
results = (
|
||||
self.session.
|
||||
query(self.entities[entity_type]).
|
||||
filter_by(**kwargs).
|
||||
all()
|
||||
filter_by(**query_params)
|
||||
)
|
||||
|
||||
print(f"[{round(time.time())}] SELECT RESULTS: {results}")
|
||||
# Obsługuje "ORDER_BY", "LIMIT", itp. itd.
|
||||
results = self.manipulate_results(results, special_args)
|
||||
|
||||
results_objs = results.all()
|
||||
print(f"[{round(time.time())}] SELECT RESULTS: {results_objs}")
|
||||
|
||||
return results_objs
|
||||
|
||||
def extract_special_args(self, dictionary: dict):
|
||||
"""
|
||||
Zwraca krotkę składającą się ze słowników z:
|
||||
- parametrami wyszukiwania
|
||||
- specjalnymi argumentami
|
||||
|
||||
:param dictionary: Słownik wejściowy
|
||||
:type dictionary: dict
|
||||
"""
|
||||
|
||||
# Save special arguments received with kwargs,
|
||||
# that are meant for SQL operations to special_args,
|
||||
# and delete from the rest, that will be passed
|
||||
# directly to filter_by().
|
||||
# They will not be passed as search query, but serve
|
||||
# as an additional search parameter.
|
||||
dictionary = dictionary.copy()
|
||||
|
||||
special_keywords = ("ORDER_BY", "ORDER_BY_DESC", "LIMIT")
|
||||
special_args = {}
|
||||
|
||||
for arg in special_keywords:
|
||||
if arg in dictionary:
|
||||
special_args[arg] = dictionary[arg]
|
||||
del dictionary[arg]
|
||||
|
||||
return dictionary, special_args
|
||||
|
||||
def manipulate_results(self, results, special_args: dict):
|
||||
"""
|
||||
Wykonuje specjalne operacje na rezultatach wyszukiwania.
|
||||
|
||||
:param results: Wyniki wyszukiwania (ORM)
|
||||
:param special_args: Specjalne operacje
|
||||
:type special_args: dict
|
||||
"""
|
||||
|
||||
if "ORDER_BY" in special_args:
|
||||
column = self.str_to_column(special_args["ORDER_BY"])
|
||||
if column is not None:
|
||||
results = results.order_by(column)
|
||||
|
||||
if "ORDER_BY_DESC" in special_args:
|
||||
column = self.str_to_column(special_args["ORDER_BY_DESC"])
|
||||
if column is not None:
|
||||
results = results.order_by(column.desc())
|
||||
|
||||
if "LIMIT" in special_args:
|
||||
results = results.limit(special_args["LIMIT"])
|
||||
|
||||
return results
|
||||
|
||||
@@ -213,7 +329,15 @@ class baza():
|
||||
if not isinstance(entity_type, str):
|
||||
entity_type = entity_type.__name__
|
||||
|
||||
print(f"[{round(time.time())}] INSERT")
|
||||
if "id" in kwargs:
|
||||
print(f"{c.FAIL}UWAGA!{c.ENDC}")
|
||||
print(f"Próbujesz dodać obiekt do tabeli, który ma już identyfikator.\n"
|
||||
f"To spowoduje problemy w przyszłości, gdy będziesz chciał dodać nowy obiekt do bazy bez ustawiania id na sztywno\n"
|
||||
f"(id klucza głównego nie zostanie zaktualizowane w sekwencji, przez co baza będzie próbowała dodać obiekt z id już istniejącego rekordu!).\n"
|
||||
f"Aby naprawić dodawanie z autoinkrementującym kluczem zobacz {c.WARNING}https://stackoverflow.com/a/8745101{c.ENDC}\n"
|
||||
f"Zostałeś ostrzeżony!")
|
||||
|
||||
print(f"[{round(time.time())}] INSERT {entity_type}")
|
||||
|
||||
obj = self.entities[entity_type](**kwargs)
|
||||
#with Session(self.db.engine) as session:
|
||||
@@ -237,6 +361,131 @@ class baza():
|
||||
return 0
|
||||
#return 1
|
||||
|
||||
@exit_gracefully
|
||||
def increment_fields(self, entity_type, record_id, **increments):
|
||||
"""
|
||||
Dodaje wartości do istniejących pól (np. goli_sum += 2).
|
||||
|
||||
Użycie:
|
||||
increment_fields(ldb.statystyki_sportowcow, 123, goli_sum=2, asyst_sum=1)
|
||||
"""
|
||||
|
||||
if not isinstance(entity_type, str):
|
||||
entity_type = entity_type.__name__
|
||||
|
||||
if entity_type not in self.entities:
|
||||
print(f"Nieznany typ encji: {entity_type}")
|
||||
return -1
|
||||
|
||||
model_class = self.entities[entity_type]
|
||||
|
||||
print(f"[{round(time.time())}] INCREMENT {entity_type}")
|
||||
|
||||
record = self.session.get(model_class, record_id)
|
||||
if not record:
|
||||
print(f"Rekord z ID {record_id} nie istnieje w tabeli {entity_type}")
|
||||
return -1
|
||||
|
||||
for key, increment_value in increments.items():
|
||||
if hasattr(record, key):
|
||||
current_value = getattr(record, key, 0)
|
||||
setattr(record, key, current_value + increment_value)
|
||||
else:
|
||||
print(f"⚠️ Pole '{key}' nie istnieje w modelu '{entity_type}' - pomijam.")
|
||||
|
||||
self.session.commit()
|
||||
return 0
|
||||
|
||||
@exit_gracefully
|
||||
def get_id_meczu_by_zewnetrzne_id(self, external_id: str) -> int | None:
|
||||
"""
|
||||
Zwraca id_meczu na podstawie zewnetrzne_id_meczu.
|
||||
|
||||
:param external_id: zewnętrzne ID meczu
|
||||
:return: id_meczu lub None jeśli nie znaleziono
|
||||
"""
|
||||
stmt = select(mecze.id_meczu).where(mecze.zewnetrzne_id_meczu == external_id)
|
||||
result = self.session.execute(stmt).scalar_one_or_none()
|
||||
return result
|
||||
|
||||
@exit_gracefully
|
||||
def get_id_zawodnika_by_zewnetrzne_id(self, external_id: str) -> int | None:
|
||||
"""
|
||||
Zwraca id_zawodnika na podstawie zewnetrzne_id_zawodnika.
|
||||
|
||||
:param external_id: zewnętrzne ID meczu
|
||||
:return: id_zawodnika lub None jeśli nie znaleziono
|
||||
"""
|
||||
stmt = select(sportowcy.id_zawodnika).where(sportowcy.zewnetrzne_id_zawodnika == external_id)
|
||||
result = self.session.execute(stmt).scalar_one_or_none()
|
||||
return result
|
||||
|
||||
@exit_gracefully
|
||||
def simple_update_one(self, entity_type, record_id, **kwargs):
|
||||
"""
|
||||
Użycie:
|
||||
simple_update_one(ldb.kluby, "polska", pelna_nazwa="Nowa Nazwa", skrocona_nazwa="NN")
|
||||
|
||||
Aktualizuje pojedynczy rekord w bazie danych na podstawie ID.
|
||||
"""
|
||||
if not isinstance(entity_type, str):
|
||||
entity_type = entity_type.__name__
|
||||
|
||||
if entity_type not in self.entities:
|
||||
print(f"Nieznany typ encji: {entity_type}")
|
||||
return -1
|
||||
|
||||
model_class = self.entities[entity_type]
|
||||
|
||||
print(f"[{round(time.time())}] UPDATE {entity_type}")
|
||||
|
||||
record = self.session.get(model_class, record_id)
|
||||
if not record:
|
||||
print(f"Rekord z ID {record_id} nie istnieje w tabeli {entity_type}")
|
||||
return -1
|
||||
|
||||
for key, value in kwargs.items():
|
||||
if hasattr(record, key):
|
||||
setattr(record, key, value)
|
||||
else:
|
||||
print(f"⚠️ Pole '{key}' nie istnieje w modelu '{entity_type}' - pomijam.")
|
||||
|
||||
self.session.commit()
|
||||
return 0
|
||||
|
||||
@exit_gracefully
|
||||
def dodaj_sportowca_w_meczu(self, entity_type, record_id, **kwargs):
|
||||
"""
|
||||
Użycie:
|
||||
dodaj_sportowca_w_meczu(ldb.sportowcy_w_meczu, ...)
|
||||
|
||||
Dodaje pojedynczy rekord w bazie danych.
|
||||
"""
|
||||
if not isinstance(entity_type, str):
|
||||
entity_type = entity_type.__name__
|
||||
|
||||
if entity_type not in self.entities:
|
||||
print(f"Nieznany typ encji: {entity_type}")
|
||||
return -1
|
||||
|
||||
model_class = self.entities[entity_type]
|
||||
|
||||
print(f"[{round(time.time())}] INSERT {entity_type}")
|
||||
|
||||
record = self.session.get(model_class, record_id)
|
||||
if not record:
|
||||
print(f"Rekord z ID {record_id} nie istnieje w tabeli {entity_type}")
|
||||
return -1
|
||||
|
||||
for key, value in kwargs.items():
|
||||
if hasattr(record, key):
|
||||
setattr(record, key, value)
|
||||
else:
|
||||
print(f"⚠️ Pole '{key}' nie istnieje w modelu '{entity_type}' - pomijam.")
|
||||
|
||||
self.session.commit()
|
||||
return 0
|
||||
|
||||
@exit_gracefully
|
||||
def sample_data_init(self, override_safety_check=False):
|
||||
"""
|
||||
@@ -270,7 +519,7 @@ class baza():
|
||||
goscie_id="undefined",
|
||||
gosp_wynik=0,
|
||||
gosc_wynik=0,
|
||||
sezon="1970/1970",
|
||||
sezon="1970-1970",
|
||||
nazwa_turnieju="Nieznany turniej",
|
||||
skrocona_nazwa_turnieju="N/A",
|
||||
flaga=0)
|
||||
@@ -286,6 +535,8 @@ class baza():
|
||||
zoltych_kartek_sum=0,
|
||||
czerwonych_kartek_sum=0,
|
||||
wygranych_sum=0,
|
||||
przegranych_sum=0,
|
||||
remisow_sum=0,
|
||||
wynik_sum=0,
|
||||
meczow_do_wynikow_sum=0)
|
||||
|
||||
@@ -304,7 +555,7 @@ class baza():
|
||||
wycena=64_940_000)
|
||||
trofeum = trofea(
|
||||
nazwa="Nieznane trofeum",
|
||||
sezon="0000/0000",
|
||||
sezon="0000-0000",
|
||||
rok=1970)
|
||||
|
||||
session.add(sportowiec)
|
||||
@@ -316,6 +567,40 @@ class baza():
|
||||
trofeum.zawodnik = sportowiec
|
||||
sportowiec.ostatnie_trofeum = trofeum
|
||||
|
||||
# MIEJSCE NA DANE KOLEJNYCH SPORTOWCÓW
|
||||
# TRZEBA ZROBIĆ TO RĘCZNIE, ZGODNIE ZE SCHEMATEM:
|
||||
# self.simple_insert_one(statystyki_sportowcow,
|
||||
# ostatni_mecz=1,
|
||||
# ilosc_wystapien=0,
|
||||
# minut_gry=0,
|
||||
# gier_sum=0,
|
||||
# goli_sum=0,
|
||||
# asyst_sum=0,
|
||||
# interwencji_sum=0,
|
||||
# nieobronionych_interwencji_sum=0,
|
||||
# zoltych_kartek_sum=0,
|
||||
# czerwonych_kartek_sum=0,
|
||||
# wygranych_sum=0,
|
||||
# przegranych_sum=0,
|
||||
# remisow_sum=0,
|
||||
# wynik_sum=0,
|
||||
# meczow_do_wynikow_sum=0)
|
||||
|
||||
# self.simple_insert_one(sportowcy,
|
||||
# zewnetrzne_id_zawodnika="...",
|
||||
# imie="...",
|
||||
# nazwisko="...",
|
||||
# data_urodzenia="...",
|
||||
# czy_aktywny=True, # NIE WSZYSCY SĄ AKTYWNI!
|
||||
# klub_id="undefined",
|
||||
# narodowosc="...",
|
||||
# ilosc_trofeow=0,
|
||||
# pierwszy_mecz_id=1,
|
||||
# ostatni_gol_dla_id="undefined",
|
||||
# statystyki_id=2, # itd...
|
||||
# wycena=...) # w złotówkach
|
||||
|
||||
session.commit()
|
||||
return 0
|
||||
|
||||
return 1
|
||||
@@ -1,4 +1,4 @@
|
||||
from git import Repo # hash ostatniego commitu
|
||||
#from git import Repo # hash ostatniego commitu
|
||||
import os
|
||||
import time
|
||||
import toml
|
||||
@@ -36,11 +36,11 @@ def getCommit() -> str | None:
|
||||
return None
|
||||
|
||||
def getCommitInFormattedHTML():
|
||||
repo = "<p>Brak informacji o wersji skryptu</p>"
|
||||
repo = "<center><p style=\"color: white;\">Brak informacji o wersji skryptu</p></center>"
|
||||
commit = getCommit()
|
||||
|
||||
if commit is not None:
|
||||
repo = f"<p>Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{commit}'>{commit[:11]}</a></p>"
|
||||
repo = f"<center><p style=\"color: white;\">Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{commit}'>{commit[:11]}</a></p></center>"
|
||||
|
||||
return repo
|
||||
|
||||
|
||||
@@ -1,8 +1,46 @@
|
||||
from flask import render_template, request, make_response
|
||||
import lewy_api_v1
|
||||
import lewy_db
|
||||
import lewy_globals
|
||||
|
||||
def get_lewy_stats():
|
||||
return {
|
||||
'all_time_stats': {
|
||||
'goals': 589+78,
|
||||
'assists':154+21,
|
||||
'matches': 791+136,
|
||||
},
|
||||
'club_stats': {
|
||||
'goals': 589,
|
||||
'assists': 154,
|
||||
'matches': 791,
|
||||
},
|
||||
'nation_stats': {
|
||||
'goals': 78,
|
||||
'assists': 21,
|
||||
'matches': 136,
|
||||
},
|
||||
'international_cups': {
|
||||
'goals': 110,
|
||||
'assists': 19,
|
||||
'matches': 152,
|
||||
},
|
||||
'national_cups': {
|
||||
'goals': 58,
|
||||
'assists': 4,
|
||||
'matches': 74,
|
||||
},
|
||||
'cards': {
|
||||
'yellow': 86,
|
||||
'red': 2,
|
||||
}
|
||||
}
|
||||
|
||||
def index():
|
||||
dark_mode = request.cookies.get('darkMode', 'disabled')
|
||||
# Przykładowe użycie endpointu last_goal_for():
|
||||
# roberts_last_goals_club = lewy_api_v1.last_goal_for()
|
||||
# print(roberts_last_goals_club.id_klubu)
|
||||
stats = {
|
||||
'goals': 38,
|
||||
'assists': 12,
|
||||
@@ -20,19 +58,71 @@ def index():
|
||||
|
||||
def mecze():
|
||||
# Możesz dostarczyć szczegóły dotyczące meczów
|
||||
selected_date = request.args.get("date", 2024)
|
||||
matches = [
|
||||
{'date': '2024-10-12', 'opponent': 'Real Madrid', 'goals': 2, 'assists': 1, 'minutes': 90},
|
||||
{'date': '2024-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2023-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2023-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2023-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2022-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2022-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2022-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2022-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2021-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2021-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2021-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2021-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2020-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2020-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2020-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2019-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2019-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
{'date': '2019-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85},
|
||||
|
||||
]
|
||||
return render_template('matches.html', matches=matches)
|
||||
|
||||
def statystyki():
|
||||
stats = {
|
||||
'goals': 38,
|
||||
'assists': 12,
|
||||
'matches': 45,
|
||||
dane=get_lewy_stats()
|
||||
return render_template('stats.html', **dane)
|
||||
|
||||
def clubs():
|
||||
selected_club = request.args.get("club","FC Barcelona")
|
||||
clubs = [
|
||||
{'club': 'FC Barcelona', 'goals': 101,'assist':20, 'matches':147,'minutes_played': 11684,'yellow_card':12,'red_card': 1, 'wins':101, 'draws': 14,'lost': 32},
|
||||
{'club': 'Bayern Monachium', 'goals': 344,'assist':73,'matches':375,'minutes_played': 31759,'yellow_card':36,'red_card': 0, 'wins':307, 'draws': 35,'lost': 33},
|
||||
{'club': 'Borussia Dortmund', 'goals': 103,'assist':42,'matches':187,'minutes_played': 14374,'yellow_card':19,'red_card': 1, 'wins':120, 'draws': 40,'lost': 27},
|
||||
{'club': 'Lech Poznan', 'goals': 41,'assist':19,'matches':82,'minutes_played': 6858,'yellow_card':9,'red_card': 0, 'wins':'-', 'draws': '-','lost': '-'},
|
||||
]
|
||||
return render_template('club.html', clubs=clubs, selected_club=selected_club)
|
||||
|
||||
def representation():
|
||||
nation_stats = {
|
||||
'goals': 85,
|
||||
'assists': 35,
|
||||
'matches': 158,
|
||||
'minutes_played': 12108,
|
||||
'yellow_card':10,
|
||||
'red_card': 0,
|
||||
'wins':75,
|
||||
'draws': 35,
|
||||
'lost': 48
|
||||
}
|
||||
return render_template('stats.html', stats=stats)
|
||||
return render_template('representation.html', nation_stats=nation_stats)
|
||||
def compare():
|
||||
selected_player = request.args.get("player","Leo Messi")
|
||||
lewy=get_lewy_stats()
|
||||
player2 = [
|
||||
{'name':'Leo Messi','goals': 34,'assists': 12},
|
||||
]
|
||||
return render_template('compare.html',player2=player2, selected_player=selected_player,**lewy, )
|
||||
def trophies():
|
||||
trophy = [
|
||||
{'name': 'asdasd', 'year': 2023},
|
||||
{'name': 'ssss', 'sezon': '2022/2023'},
|
||||
]
|
||||
return render_template('trophies.html',trophy=trophy)
|
||||
|
||||
def toggle_dark_mode():
|
||||
# Przełącz tryb i zapisz w ciasteczku
|
||||
|
||||
BIN
FlaskWebProject/FlaskWebProject/static/Borussia_Dortmund.png
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/FC_Barcelona.png
Normal file
|
After Width: | Height: | Size: 206 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/FC_Bayern.png
Normal file
|
After Width: | Height: | Size: 186 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/Lech_Poznan.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/fonts/Exo2-ExtraBold.ttf
Normal file
BIN
FlaskWebProject/FlaskWebProject/static/fonts/Exo2-SemiBold.ttf
Normal file
BIN
FlaskWebProject/FlaskWebProject/static/gigabuła.png
Normal file
|
After Width: | Height: | Size: 244 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/lewandowski_no_bg.png
Normal file
|
After Width: | Height: | Size: 351 KiB |
BIN
FlaskWebProject/FlaskWebProject/static/soccer-field.jpg
Normal file
|
After Width: | Height: | Size: 132 KiB |
@@ -1,3 +1,21 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Exo2SemiBold';
|
||||
src: url('fonts/Exo2-SemiBold.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Exo2ExtraBold';
|
||||
src: url('fonts/Exo2-ExtraBold.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
:root {
|
||||
--barca-blue: #002147;
|
||||
--barca-red: #A50044;
|
||||
@@ -5,73 +23,276 @@
|
||||
--polska-red-dark: #DC143C;
|
||||
--polska-red: #E30B17;
|
||||
--polska-white: #FFFFFF;
|
||||
|
||||
--polska-section-color: #121623;
|
||||
--section-color: #051839;
|
||||
--pink-highlight: #E1317E;
|
||||
--blue-highlight: #00B9BF;
|
||||
--yellow-highlight: #FFD23F;
|
||||
--border-radius: 5px;
|
||||
}
|
||||
|
||||
/* Podstawowy styl */
|
||||
body {
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
font-family: 'Exo2ExtraBold', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: white;
|
||||
color: #222;
|
||||
background-color: var(--section-color);
|
||||
color: black;
|
||||
transition: all 0s ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch; /* Wyśrodkowanie elementów w poziomie */
|
||||
justify-content: flex-start; /* Ustalamy początek na górze */
|
||||
align-items: stretch;
|
||||
/* Wyśrodkowanie elementów w poziomie */
|
||||
justify-content: flex-start;
|
||||
/* Ustalamy początek na górze */
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.header-content {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 20px 0;
|
||||
background: var(--section-color);
|
||||
color: white;
|
||||
font-size: 15px;
|
||||
z-index: -2;
|
||||
position: relative;
|
||||
margin-top: 60px;
|
||||
/* box-shadow: 0px -5px 10px 2px rgba(0, 0, 0, 0.347); */
|
||||
}
|
||||
|
||||
|
||||
.header-content h1 {
|
||||
border-bottom: 10px solid var(--barca-red);
|
||||
border-radius: 10px;
|
||||
padding: 5px;
|
||||
animation: header-content 500ms ease;
|
||||
transform: skewX(-5deg);
|
||||
}
|
||||
|
||||
.header-content-special {
|
||||
font-size: 50px;
|
||||
color: var(--barca-gold);
|
||||
}
|
||||
|
||||
.profile-image {
|
||||
width: 40%;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.profile-image-cover {
|
||||
background: linear-gradient(185deg, transparent 40% 60%, var(--section-color) 85%, var(--section-color) 90%);
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
|
||||
.profile-image img {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
animation: header-content 400ms ease;
|
||||
background: linear-gradient(90deg, var(--barca-blue) 50%, var(--barca-red) 50% 100%);
|
||||
border-radius: var(--border-radius);
|
||||
transform: skewX(2deg) skewY(0deg);
|
||||
}
|
||||
|
||||
@keyframes header-content {
|
||||
0% {
|
||||
opacity: 00%;
|
||||
transform: skewX(30deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
header button {
|
||||
border: none;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
|
||||
/* Styl nawigacji */
|
||||
.navbar {
|
||||
|
||||
background: linear-gradient(to right, #002147, #A50044);
|
||||
color: white;
|
||||
padding: 1rem 1rem;
|
||||
|
||||
padding: 2.3rem 1rem;
|
||||
height: 1.5rem;
|
||||
position: sticky;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100% - 2rem;
|
||||
width: 100%;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.navbar ul {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo-text {
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
color: var(--barca-gold);
|
||||
}
|
||||
|
||||
.logo-icon {
|
||||
font-size: 2.8em;
|
||||
}
|
||||
|
||||
.logo-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
gap: 0rem;
|
||||
list-style: none;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nav-links li a {
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
padding: 1rem 1.25rem; /* dopasowane do .navbar padding */
|
||||
height: 100%;
|
||||
border-radius: 0;
|
||||
color: var(--barca-gold);
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
color: white;
|
||||
/* dopasowane do .navbar padding */
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: 0.3s ease;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 10px;
|
||||
height: 100%;
|
||||
transition: 100ms ease;
|
||||
position: relative;
|
||||
}
|
||||
li button{
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
|
||||
.nav-links li a::before {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0%;
|
||||
font-size: 25px;
|
||||
transition: 100ms ease;
|
||||
}
|
||||
|
||||
.nav-links li:hover a::before {
|
||||
opacity: 100%;
|
||||
transform: translateY(-20px);
|
||||
}
|
||||
|
||||
.nav-links li:nth-child(1) a::before {
|
||||
content: "🏠";
|
||||
}
|
||||
|
||||
.nav-links li:nth-child(2) a::before {
|
||||
content: "📅";
|
||||
}
|
||||
|
||||
.nav-links li:nth-child(3) a::before {
|
||||
content: "📊";
|
||||
}
|
||||
|
||||
.nav-links li:nth-child(4) a::before {
|
||||
content: "🤝";
|
||||
}
|
||||
.nav-links li:nth-child(5) a::before {
|
||||
content: "⚽";
|
||||
}
|
||||
.nav-links li:nth-child(6) a::before {
|
||||
content: "🏆";
|
||||
}
|
||||
.nav-links li:nth-child(7) a::before {
|
||||
content: "🔎";
|
||||
}
|
||||
|
||||
.nav-links li {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.nav-links li:has(button) {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.nav-links li button {
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
padding: 20px;
|
||||
font-size: 30px;
|
||||
border-radius: 50%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: var(--bg-color);
|
||||
border: none;
|
||||
}
|
||||
|
||||
.nav-links li a:hover,
|
||||
.nav-links li button {
|
||||
background-color: var(--barca-blue);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
box-shadow: 0px 0px 6px 1px #FDB913;
|
||||
transition: 100ms ease;
|
||||
}
|
||||
|
||||
.nav-links li button:hover {
|
||||
transform: scale(1.1, 1.1);
|
||||
}
|
||||
|
||||
.nav-links li button::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -1px;
|
||||
background-color: var(--barca-red);
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nav-links li button::before {
|
||||
content: "";
|
||||
background: url('FC_Barcelona.png');
|
||||
background-size: contain;
|
||||
z-index: 1;
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.nav-links a:hover {
|
||||
background-color: var(--barca-gold, #FDB913);
|
||||
color: var(--barca-blue, #002147);
|
||||
}
|
||||
@@ -83,20 +304,32 @@ li button{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@media (max-width: 1090px) {
|
||||
/* .base-header .navbar:not(:has(.show))
|
||||
{
|
||||
margin-bottom: 400px;
|
||||
} */
|
||||
|
||||
|
||||
.nav-links {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
background-color: #002147;
|
||||
position: absolute;
|
||||
top: 2.5rem;
|
||||
right: 0rem;
|
||||
flex-direction: column;
|
||||
top: 57px;
|
||||
right: 0px;
|
||||
padding: 0rem;
|
||||
gap: 0;
|
||||
width: 200px;
|
||||
height: auto;
|
||||
backdrop-filter: blur(4px);
|
||||
width: 30%;
|
||||
justify-content: center;
|
||||
box-shadow: 0px 0px 5px 5px rgba(0, 0, 0, 0.105);
|
||||
}
|
||||
|
||||
.nav-links li {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.nav-links li a,
|
||||
@@ -106,22 +339,182 @@ li button{
|
||||
text-align: left;
|
||||
padding: 1rem;
|
||||
margin: 0;
|
||||
border-radius: 0; /* brak zaokrągleń w mobilnym menu */
|
||||
border-radius: 0;
|
||||
/* brak zaokrągleń w mobilnym menu */
|
||||
}
|
||||
.nav-links li button
|
||||
{
|
||||
background-color: none;
|
||||
width: 45px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.nav-links li button::before,.nav-links li button::after
|
||||
{
|
||||
background-color: none
|
||||
;
|
||||
}
|
||||
.nav-links li button:hover
|
||||
{
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.nav-links.show {
|
||||
display: flex;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.hamburger {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1000px)
|
||||
{
|
||||
.header-content
|
||||
{
|
||||
flex-direction: column;
|
||||
}
|
||||
.header-content .profile-image
|
||||
{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
.header-content .profile-image img{
|
||||
width: 100%;
|
||||
}
|
||||
.about-section-image
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Wyśrodkowanie głównej zawartości */
|
||||
main {
|
||||
padding: 0px; /* Maksymalna szerokość treści */
|
||||
text-align: center; /* Wyśrodkowanie tekstu */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.main-index {
|
||||
border-radius: var(--border-radius);
|
||||
margin-top: 20px;
|
||||
padding: 20px;
|
||||
width: 80%;
|
||||
max-width: 1200px;
|
||||
background-color: rgba(255, 255, 255, 0.086);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.about-section {
|
||||
border-radius: var(--border-radius);
|
||||
background-color: var(--barca-blue);
|
||||
padding: 20px;
|
||||
color: white;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-gap: 20px;
|
||||
grid-template-areas:
|
||||
"how how"
|
||||
"- about-section-image"
|
||||
"- about-section-image"
|
||||
"- about-section-image";
|
||||
}
|
||||
|
||||
.about-section article h3 {
|
||||
background-color: var(--barca-gold);
|
||||
color: black;
|
||||
text-align: center;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.about-section article h4 {
|
||||
background-color: #00B9BF;
|
||||
width: fit-content;
|
||||
padding: 10px;
|
||||
color: black;
|
||||
border-radius: (--border-radius)
|
||||
}
|
||||
|
||||
.article__how-it-works {
|
||||
grid-area: how;
|
||||
}
|
||||
|
||||
.about-section article a {
|
||||
display: block;
|
||||
width: 100%;
|
||||
color: var(--barca-gold);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.about-section-image {
|
||||
grid-area: about-section-image;
|
||||
z-index: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.about-section-image::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
|
||||
z-index: -1;
|
||||
background-color: #051839;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.about-section-image img {
|
||||
width: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.general-stats-section {
|
||||
border-radius: var(--border-radius);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.general-stats-section h2 {
|
||||
width: 100%;
|
||||
background-color: #002147;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
.general-stats-section .grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
height: 150px;
|
||||
gap: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.general-stats-section .grid article {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
.general-stats-section .grid article:nth-child(1){background-color: var(--blue-highlight);}
|
||||
.general-stats-section .grid article:nth-child(2){background-color: var(--yellow-highlight);}
|
||||
.general-stats-section .grid article:nth-child(3){background-color: var(--pink-highlight);}
|
||||
.general-stats-section .grid p
|
||||
{
|
||||
font-size: 40px;
|
||||
}
|
||||
.general-stats-section .grid h3, .general-stats-section .grid p
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Styl dla tabeli */
|
||||
@@ -131,7 +524,8 @@ table {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
th,
|
||||
td {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
text-align: center;
|
||||
@@ -143,10 +537,55 @@ th, td {
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
margin: 0 auto; /* Wyśrodkowanie obrazka */
|
||||
margin: 0 auto;
|
||||
/* Wyśrodkowanie obrazka */
|
||||
}
|
||||
|
||||
.section__matches
|
||||
{
|
||||
background-color: white;
|
||||
width: 80%;
|
||||
border-radius: var(--border-radius);
|
||||
max-width: 1000px;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.section__matches h2
|
||||
{
|
||||
margin: 0;
|
||||
border-radius: var(--border-radius);
|
||||
background-color: var(--barca-gold);
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.section__matches td:nth-child(1)
|
||||
{
|
||||
border-radius: 25px 0 0px 25px;
|
||||
}
|
||||
|
||||
.section__matches td:last-child
|
||||
{
|
||||
border-radius: 0 25px 25px 0;
|
||||
}
|
||||
.section__matches th
|
||||
{
|
||||
font-size: 1.3em;
|
||||
color: var(--barca-red)
|
||||
}
|
||||
.section__matches tr
|
||||
{
|
||||
transition: 100ms ease;
|
||||
}
|
||||
.section__matches tr:hover:has(:not(th))
|
||||
{
|
||||
transform: scale(1.05,1.05);
|
||||
background-color: #00B9BF;
|
||||
}
|
||||
|
||||
/* Styl dla trybu polskiego */
|
||||
body.poland-mode {
|
||||
background-color: var(--polska-section-color);
|
||||
}
|
||||
|
||||
body.poland-mode .navbar {
|
||||
background: linear-gradient(to bottom, #bd4148, #dc1414);
|
||||
}
|
||||
@@ -154,50 +593,133 @@ body.poland-mode .navbar {
|
||||
body.poland-mode .logo {
|
||||
color: var(--polska-white)
|
||||
}
|
||||
|
||||
body.poland-mode .logo-text {
|
||||
color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li a {
|
||||
color: white;
|
||||
}
|
||||
body.poland-mode .nav-links li button:hover,
|
||||
|
||||
body.poland-mode .nav-links li a:hover {
|
||||
background-color: #e96161;
|
||||
color:#220000
|
||||
color: #220000;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li button::before {
|
||||
background: none;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li button {
|
||||
background-color: red;
|
||||
box-shadow: 0px 0px 6px 5px rgba(109, 0, 0, 0.219);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body.poland-mode .nav-links li button::after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: white;
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
body.poland-mode .profile-image img {
|
||||
width: 100%;
|
||||
animation: header-content 300ms ease;
|
||||
background: linear-gradient(rgba(255, 255, 255, 0.534) 50%, rgba(255, 0, 0, 0.551) 50% 100%);
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
body.poland-mode .header-content-special {
|
||||
font-size: 50px;
|
||||
color: red;
|
||||
}
|
||||
|
||||
body.poland-mode .header-content {
|
||||
background-color: var(--polska-section-color)
|
||||
}
|
||||
|
||||
body.poland-mode .header-content h1 {
|
||||
border-bottom-color: red;
|
||||
}
|
||||
|
||||
body.poland-mode .profile-image-cover {
|
||||
background: linear-gradient(185deg, transparent 40% 60%, var(--polska-section-color) 85%, var(--polska-section-color) 90%);
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
|
||||
body.poland-mode .hamburger {
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body.poland-mode .nav-links {
|
||||
background-color: var(--polska-red);/*Ale oczopląs*/
|
||||
}
|
||||
/* body.poland-mode .nav-links {
|
||||
background-color: var(--polska-red);
|
||||
/*Ale oczopląs*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
body.poland-mode .section-stats {
|
||||
background: linear-gradient(to bottom, #bd4148, #dc1414);
|
||||
}
|
||||
|
||||
body.poland-mode .section-stats h2 {
|
||||
color:#220000
|
||||
color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .stat-box {
|
||||
border-color: white;
|
||||
background: linear-gradient(to bottom, #ff0000,#231212);
|
||||
}
|
||||
|
||||
body.poland-mode .stat-box h3 {
|
||||
color: white;
|
||||
}
|
||||
/* Przyciski i elementy */
|
||||
header button {
|
||||
padding: 10px 15px;
|
||||
border: none;
|
||||
background-color: #007bff;
|
||||
body.poland-mode .club-stats h2{
|
||||
background: linear-gradient(to bottom, #ff0000,#231212);
|
||||
border: 4px solid white;
|
||||
color: white;
|
||||
}
|
||||
body.poland-mode .about-section {
|
||||
background-color: var(--polska-section-color);
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
header button:hover {
|
||||
background-color: #0056b3;
|
||||
body.poland-mode .about-section article h3 {
|
||||
background-color: var(--polska-red-dark);
|
||||
color: white;
|
||||
}
|
||||
|
||||
body.poland-mode .about-section article h4 {
|
||||
background-color: #ffcaca;
|
||||
color: black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
body.poland-mode .general-stats-section h2 {
|
||||
background: var(--polska-section-color);
|
||||
}
|
||||
body.poland-mode .general-stats-section .grid article:nth-child(1){background-color: var(--polska-red-dark);}
|
||||
body.poland-mode .general-stats-section .grid article:nth-child(2){background-color: var(--yellow-highlight);}
|
||||
body.poland-mode .general-stats-section .grid article:nth-child(3){background-color: var(--barca-blue);}
|
||||
body.poland-mode .about-section-image::after{
|
||||
background:var(--polska-red-dark);
|
||||
}
|
||||
/* Przyciski i elementy */
|
||||
|
||||
|
||||
/* Style dla listy meczów */
|
||||
.section-stats {
|
||||
background: linear-gradient(135deg, #002147, #A50044);
|
||||
@@ -207,20 +729,35 @@ header button:hover {
|
||||
padding: 2rem 2rem;
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.section-stats-center
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 30px;
|
||||
justify-content: center;
|
||||
}
|
||||
@media (max-width: 1400px) {
|
||||
|
||||
.section-stats-center
|
||||
{
|
||||
grid-template-columns: 1fr !important;
|
||||
}
|
||||
}
|
||||
.section-stats h2 {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
color: var(--barca-red);
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
text-align: center;
|
||||
margin-top: 2rem;
|
||||
flex-wrap: wrap;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
@@ -234,11 +771,84 @@ header button:hover {
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.stat-box:hover {
|
||||
transform: scale(1.1, 1.1);
|
||||
}
|
||||
|
||||
.stat-box h3 {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--barca-gold);
|
||||
}
|
||||
|
||||
.stat-box p {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.choose-club
|
||||
{
|
||||
margin: 10px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.choose-club button {
|
||||
width: 100px;
|
||||
border: none;
|
||||
|
||||
background-color:transparent;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.choose-club button img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color:transparent;
|
||||
transition: transform 100ms ease;
|
||||
}
|
||||
|
||||
.choose-club button img:hover {
|
||||
transform: scale(1.3,1.3) translateY(-10px);
|
||||
}
|
||||
.club-stats h2{
|
||||
color: var(--barca-gold);
|
||||
text-align: center;
|
||||
border: 5px solid var(--barca-red);
|
||||
background-color: var(--barca-blue);
|
||||
padding: 20px;
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
.stat-box
|
||||
{
|
||||
padding: 20px;
|
||||
background-color: var(--barca-blue);
|
||||
display: grid;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
text-align: center;
|
||||
}
|
||||
.stat-box-special
|
||||
{text-align: center;
|
||||
display: block;
|
||||
font-size: 40px;
|
||||
color: var(--barca-gold);
|
||||
}
|
||||
.club-stats-grid
|
||||
{
|
||||
display: grid;
|
||||
margin-bottom: 50px;
|
||||
gap: 10px;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr 1fr;
|
||||
}
|
||||
select
|
||||
{
|
||||
color: white;
|
||||
padding: 20px;
|
||||
margin: 10px;
|
||||
font-size: 24px;
|
||||
background-color: var(--barca-blue);
|
||||
border-radius: 10px;
|
||||
border: 2px solid white;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@@ -13,24 +14,32 @@
|
||||
<meta property="og:image:height" content="143">
|
||||
<meta property="og:image:width" content="100">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class="base-header">
|
||||
<nav class="navbar">
|
||||
<div class="logo">Robert Lewandowski</div>
|
||||
<a class="logo-link" href="/"><div class="logo-text">Robert Lewandowski</div></a>
|
||||
<ul class="nav-links">
|
||||
<li><a href="/">🏠 Strona główna</a></li>
|
||||
<li><a href="/mecze">📅 Mecze</a></li>
|
||||
<li><a href="/statystyki">📊 Statystyki</a></li>
|
||||
<li><a href="/statystyki">📊 Statystyki</a></li>
|
||||
<li><button id="theme-toggle" onclick="toggleTheme()">🌙 / 🌞</button></li>
|
||||
<li><a href="/">Strona główna</a></li>
|
||||
<li><a href="/mecze">Mecze</a></li>
|
||||
<li><a href="/statystyki">Statystyki</a></li>
|
||||
<li><a href="/club">Kluby</a></li>
|
||||
<li><a href="/representation">Reprezentacja</a></li>
|
||||
<li><a href="/trophies">Trofea</a></li>
|
||||
<li><a href="/compare">Porównaj</a></li>
|
||||
<li><button id="theme-toggle" onclick="toggleTheme()"></button></li>
|
||||
</ul>
|
||||
<div class="hamburger">☰</div>
|
||||
</nav>
|
||||
|
||||
<header>
|
||||
<div class="header-content">
|
||||
<center><img src="{{ url_for('static', filename='lewandowski.jpg') }}" alt="Robert Lewandowski" class="profile-image"></center>
|
||||
<h1>Statystyki Roberta Lewandowskiego</h1>
|
||||
<div class="profile-image">
|
||||
<img src="{{ url_for('static', filename='lewandowski_no_bg.png') }}" alt="Robert Lewandowski">
|
||||
<div class="profile-image-cover"></div>
|
||||
</div>
|
||||
<h1>Statystyki <br><span class="header-content-special"> Roberta <br> Lewandowskiego</span></h1>
|
||||
</div>
|
||||
<div></div>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
@@ -40,7 +49,8 @@
|
||||
const hamburger = document.querySelector('.hamburger');
|
||||
const navLinks = document.querySelector('.nav-links');
|
||||
hamburger.addEventListener('click', () => {
|
||||
navLinks.classList.toggle('show');});
|
||||
navLinks.classList.toggle('show');
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function toggleTheme() {
|
||||
@@ -63,4 +73,5 @@
|
||||
{% block footer %}{% endblock %}
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
64
FlaskWebProject/FlaskWebProject/templates/club.html
Normal file
@@ -0,0 +1,64 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Strona Główna{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="choose-club">
|
||||
<a href="{{ url_for('clubs', club='FC Barcelona') }}">
|
||||
<button><img src="{{ url_for('static', filename='FC_Barcelona.png') }}"></button>
|
||||
</a>
|
||||
<a href="{{ url_for('clubs', club='Bayern Monachium') }}">
|
||||
<button><img src="{{ url_for('static', filename='FC_Bayern.png') }}"></button>
|
||||
</a>
|
||||
<a href="{{ url_for('clubs', club='Borussia Dortmund') }}">
|
||||
<button><img src="{{ url_for('static', filename='Borussia_Dortmund.png') }}"></button>
|
||||
</a>
|
||||
<!--Jak nie będzie statysytk dla lecha to usunać-->
|
||||
<a href="{{ url_for('clubs', club='Lech Poznan') }}">
|
||||
<button><img src="{{ url_for('static', filename='Lech_Poznan.png') }}"></button>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<!-- Wyświetlanie danych tylko dla wybranego klubu -->
|
||||
{% for stats in clubs %}
|
||||
{% if stats.club == selected_club %}
|
||||
<section class="club-stats">
|
||||
<h2>Statystyki dla {{selected_club}}</h2>
|
||||
<div class="wybrany{{selected_club}}"></div>
|
||||
<div class="club-stats-grid">
|
||||
<div class="stat-box">
|
||||
<p>Gole:</p> <span class="stat-box-special"> {{ stats.goals }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Asysty:</p> <span class="stat-box-special"> {{ stats.assist }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Występy:</p> <span class="stat-box-special"> {{ stats.matches }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Łączny czas gry:</p> <span class="stat-box-special"> {{ stats.minutes_played }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Żółte kartki:</p> <span class="stat-box-special"> {{ stats.yellow_card }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Czerwone kartki:</p> <span class="stat-box-special"> {{ stats.red_card }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Zwycięstwa:</p> <span class="stat-box-special"> {{ stats.wins }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Remisy:</p> <span class="stat-box-special"> {{ stats.draws }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Porażki:</p> <span class="stat-box-special"> {{ stats.lost }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{{ commit_in_html | safe }}
|
||||
{% endblock %}
|
||||
68
FlaskWebProject/FlaskWebProject/templates/compare.html
Normal file
@@ -0,0 +1,68 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Statystyki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<select onchange="location = this.value;">
|
||||
<option disabled selected>Wybierz zawodnika</option>
|
||||
<option value="{{ url_for('compare', player='Leo Messi') }}">Leo Messi</option>
|
||||
<option value="{{ url_for('compare', player='Ronaldo') }}">Cristiano Ronaldo</option>
|
||||
<option value="{{ url_for('compare', player='Neymar') }}">Neymar</option>
|
||||
</select>
|
||||
|
||||
{%for player in player2 %}
|
||||
{% if player.name == selected_player %}
|
||||
<section class="section-stats">
|
||||
<h2>Gole</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.goals }}</h3>
|
||||
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ player.goals}}</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h2>Asysty</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.assists }}</h3>
|
||||
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ player.assists}}</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Wystąpienia</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.assists }}</h3>
|
||||
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ player.assists}}</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Minuty zagrane</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ all_time_stats.assists }}</h3>
|
||||
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ player.assists}}</h3>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor%}
|
||||
|
||||
{% endblock %}
|
||||
@@ -3,13 +3,56 @@
|
||||
{% block title %}Strona Główna{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Witaj na stronie poświęconej statystykom Roberta Lewandowskiego!</h2>
|
||||
<div class="main-index">
|
||||
<h2>Witaj na stronie poświęconej <br> statystykom Roberta Lewandowskiego!</h2>
|
||||
<p>Tu znajdziesz najnowsze informacje o meczach, golach, asystach i innych statystykach.</p>
|
||||
<div>
|
||||
<h3>Ogólne statystyki:</h3>
|
||||
<p>Gole: {{ goals }}</p>
|
||||
<p>Asysty: {{ assists }}</p>
|
||||
<p>Liczba meczów: {{ matches }}</p>
|
||||
<section class="about-section">
|
||||
<article class="article__how-it-works">
|
||||
<h3>Jak to działa?</h3>
|
||||
<h4>Pobieranie statystyk</h4>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ratione harum minus hic, voluptate perspiciatis laborum? Alias maxime, voluptate reprehenderit iusto dolorem officiis porro voluptatibus repellat dicta doloribus, blanditiis similique accusantium.</p>
|
||||
<h4>Porównywanie zawodników</h4>
|
||||
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Fuga, in perspiciatis. Sequi laborum et animi quas sit voluptatibus alias sed ad molestias nulla vel cum, consectetur commodi odio aliquam officia.</p>
|
||||
</article>
|
||||
<div class="about-section-image">
|
||||
<img src="{{ url_for('static', filename='gigabuła.png') }}">
|
||||
</div>
|
||||
<article>
|
||||
<h3>Mecze</h3>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ullam iusto ex? Quo amet officia aliquam odio sint harum nam eaque nihil ipsa quos aliquid, illum voluptatum, numquam, magnam omnis?</p>
|
||||
<a href="/mecze">Zobacz mecze</a>
|
||||
</article>
|
||||
<article>
|
||||
<h3>Statystyki</h3>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Temporibus dolore tenetur nulla sint recusandae illo dolores aspernatur ducimus, omnis vitae ipsam neque animi voluptates eos porro, nihil iusto veniam commodi!</p>
|
||||
<a href="/statystyki">Zobacz statystyki</a>
|
||||
</article>
|
||||
<article>
|
||||
<h3>Osiągnięcia</h3>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod dicta veritatis quibusdam eligendi corrupti. Expedita delectus assumenda ipsum illum molestias a voluptates, voluptas quia reprehenderit, quod non, eum veritatis tenetur!</p>
|
||||
<a href="/club">Zobacz osiągnięcia</a>
|
||||
</article>
|
||||
</section>
|
||||
<!--
|
||||
<section class="general-stats-section">
|
||||
<h2>Ogólne statystyki:</h3>
|
||||
<div class="grid">
|
||||
|
||||
<article>
|
||||
<h3>Gole:</h3>
|
||||
<p>{{ goals }}</p>
|
||||
</article>
|
||||
<article>
|
||||
<h3>Asysty</h3>
|
||||
<p>{{ assists }}</p>
|
||||
</article>
|
||||
<article>
|
||||
<h3>Liczba meczów</h3>
|
||||
<p>{{ matches }}</p>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
-->
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -3,6 +3,19 @@
|
||||
{% block title %}Lista meczów{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<select>
|
||||
<option disabled selected>Wybierz rok</option>
|
||||
<option value="{{ url_for('compare', player='Leo Messi') }}">2024/2025</option>
|
||||
<option value="{{ url_for('compare', player='Ronaldo') }}">2023/2024</option>
|
||||
<option value="{{ url_for('compare', player='Neymar') }}">2022/2023</option>
|
||||
<option value="{{ url_for('compare', player='Neymar') }}">2021/2022</option>
|
||||
<option value="{{ url_for('compare', player='Neymar') }}">2020/2021</option>
|
||||
<option value="{{ url_for('compare', player='Neymar') }}">2019/2020</option>
|
||||
<option value="{{ url_for('compare', player='Neymar') }}">2018/2019</option>
|
||||
<option value="{{ url_for('compare', player='Neymar') }}">2017/2018</option>
|
||||
<option value="{{ url_for('compare', player='Neymar') }}">2016/2017</option>
|
||||
</select>
|
||||
<section class="section__matches">
|
||||
<h2>📅 Mecze Roberta</h2>
|
||||
<table>
|
||||
<tr>
|
||||
@@ -22,4 +35,5 @@
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Statystyki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="club-stats club-stats-poland">
|
||||
<h2>Statystyki w reprezentacji Polski</h2>
|
||||
<div class="wybrany{{selected_club}}"></div>
|
||||
<div class="club-stats-grid">
|
||||
<div class="stat-box">
|
||||
<p>Gole:</p> <span class="stat-box-special"> {{ nation_stats.goals }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Asysty:</p> <span class="stat-box-special"> {{ nation_stats.assists }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Występy:</p> <span class="stat-box-special"> {{ nation_stats.goals }} </span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Łączny czas gry:</p> <span class="stat-box-special"> {{ nation_stats.minutes_played }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Żółte kartki:</p> <span class="stat-box-special"> {{ nation_stats.yellow_card }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Czerwone kartki:</p> <span class="stat-box-special"> {{ nation_stats.red_card }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Zwycięstwa:</p> <span class="stat-box-special"> {{ nation_stats.wins }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Remisy:</p> <span class="stat-box-special"> {{ nation_stats.draws }}</span>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<p>Porażki:</p> <span class="stat-box-special"> {{ nation_stats.lost }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -3,37 +3,103 @@
|
||||
{% block title %}Statystyki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="section-stats-center">
|
||||
|
||||
<section class="section-stats">
|
||||
<h2>All time stats</h2>
|
||||
<h2>Ogólne statystyki</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ stats.goals }}</h3>
|
||||
<p>Goals</p>
|
||||
<h3>{{ all_time_stats.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ stats.assists }}</h3>
|
||||
<p>Assists</p>
|
||||
<h3>{{ all_time_stats.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ stats.matches }}</h3>
|
||||
<p>Apps</p>
|
||||
<h3>{{ all_time_stats.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>All time stats</h2>
|
||||
<h2>Klubowe statystyki</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ stats.goals }}</h3>
|
||||
<p>Goals</p>
|
||||
<h3>{{ club_stats.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ stats.assists }}</h3>
|
||||
<p>Assists</p>
|
||||
<h3>{{ club_stats.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ stats.matches }}</h3>
|
||||
<p>Apps</p>
|
||||
<h3>{{ club_stats.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Reprezentacja statystyki</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ nation_stats.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ nation_stats.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ nation_stats.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Puchary międzynarodowe</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ international_cups.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ international_cups.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ international_cups.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Puchary krajowe</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ national_cups.goals }}</h3>
|
||||
<p>Gole</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ national_cups.assists }}</h3>
|
||||
<p>Asysty</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ national_cups.matches }}</h3>
|
||||
<p>Występy</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="section-stats">
|
||||
<h2>Kartki</h2>
|
||||
<div class="stats">
|
||||
<div class="stat-box">
|
||||
<h3>{{ cards.yellow }}</h3>
|
||||
<p>Żółte</p>
|
||||
</div>
|
||||
<div class="stat-box">
|
||||
<h3>{{ cards.red }}</h3>
|
||||
<p>Czerwone</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
28
FlaskWebProject/FlaskWebProject/templates/trophies.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Statystyki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="section__matches">
|
||||
<h2>📅 Trofea</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Nazwa</th>
|
||||
<th>Data/Sezon</th>
|
||||
</tr>
|
||||
{% for trophy in trophy %}
|
||||
|
||||
<tr>
|
||||
<td>{{ trophy.name }}</td>
|
||||
{% if trophy.year == NULL %}
|
||||
<td>{{ trophy.sezon }}</td>
|
||||
{% endif %}
|
||||
{% if trophy.sezon == NULL %}
|
||||
<td>{{ trophy.year }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||