17 Commits

Author SHA1 Message Date
416b2ccfe0 changing responsive design 2025-06-12 23:08:58 +02:00
919d64ca5e Merge branch 'master' into frontend 2025-06-05 10:30:04 +02:00
2cfa5f1fa4 poland-style changes 2025-06-05 10:27:11 +02:00
9b45a3f26f polandmode statbox color 2025-06-05 00:47:59 +02:00
3dfc40cdb0 trophies update and hamburger fix 2025-06-05 00:40:47 +02:00
be951d296f representation changes 2025-06-04 17:02:57 +02:00
6e1e8ccc7d stats maches club style changes 2025-06-04 16:55:31 +02:00
03463905ef fixing responsive 2025-06-04 15:32:03 +02:00
35db71b8cc feat: get sportsmen full name and birthday from id 2025-06-04 00:19:57 +02:00
f65a174089 skeleton to all sites (i hope) 2025-06-03 23:26:30 +02:00
bdfa31c8ea fix: check for id in simple_insert_one() to avoid breaking autoincrement 2025-06-03 21:46:59 +02:00
206f7d6fb3 Merge branch 'frontend' of https://gitea.7o7.cx/roberteam/lewangoalski into frontend 2025-06-03 09:10:08 +02:00
df0e47c610 base page style 2025-06-03 09:09:59 +02:00
3b9aa8150b feat: new last_goal_for endpoint, simple_select_all improvements
also introduces sample usage for the new endpoint in lewy_routes
2025-06-03 02:38:13 +02:00
bc557b35af header style and font changes 2025-06-03 02:01:19 +02:00
4987dc4cf7 . 2025-06-02 00:34:03 +02:00
48825185b8 begining of history section 2025-06-02 00:32:27 +02:00
23 changed files with 1407 additions and 255 deletions

View File

@@ -61,6 +61,34 @@ class scraper:
# return False # return False
return self.__czy_x_istnieje("kluby", id_klubu=id_klubu) 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"): def aktualizuj_dane_sportowca(self, zewnetrzne_id_sportowca: str = "MVC8zHZD"):
stop_scraping = False stop_scraping = False
matches_to_add = [] matches_to_add = []

View File

@@ -62,11 +62,15 @@ def setup():
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# Widoki widoczne dla "normalnego" użytkownika: # Widoki widoczne dla "normalnego" użytkownika:
app.add_url_rule('/', view_func=lewy_routes.index) app.add_url_rule('/', view_func=lewy_routes.index)
app.add_url_rule('/index.html', view_func=lewy_routes.index) app.add_url_rule('/index.html', view_func=lewy_routes.index)
app.add_url_rule('/mecze', view_func=lewy_routes.mecze) app.add_url_rule('/mecze', view_func=lewy_routes.mecze)
app.add_url_rule('/statystyki', view_func=lewy_routes.statystyki) 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('/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: # API:
app.add_url_rule('/api/', view_func=lewy_api.api_greeting) app.add_url_rule('/api/', view_func=lewy_api.api_greeting)

View File

@@ -105,6 +105,20 @@ def debugger_halt(r):
breakpoint() breakpoint()
return 200, "ok", [] 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): def lookup(data, request):
""" """
Obsługuje zapytania zwrócone do /api/v1/... Obsługuje zapytania zwrócone do /api/v1/...

View File

@@ -6,9 +6,22 @@ from sqlalchemy.orm import Mapped, mapped_column, DeclarativeBase, Session, rela
from typing import List from typing import List
import time import time
import toml import toml
import traceback
global db 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(): class baza():
# global sportowcy, trofea, sportowcy_w_meczach, statystyki_sportowcow, kluby, mecze # global sportowcy, trofea, sportowcy_w_meczach, statystyki_sportowcow, kluby, mecze
@@ -167,18 +180,40 @@ class baza():
try: try:
return_val = func(self, *args, **kwargs) return_val = func(self, *args, **kwargs)
except: 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.rollback()
self.session.close() self.session.close()
self.refresh_session() self.refresh_session()
return return_val return return_val
return wrapper 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
"""
table_str = string[:string.find('.')]
column_str = string[string.find('.') + 1:]
if hasattr(self.entities[table_str], column_str):
return getattr(self.entities[table_str], column_str)
return None
@exit_gracefully @exit_gracefully
def simple_select_all(self, entity_type, **kwargs): def simple_select_all(self, entity_type, **kwargs):
""" """
Użycie: Użycie:
simple_select_all(ldb.sportowcy, zewnetrzne_id_zawodnika="MVC8zHZD") simple_select_all(ldb.sportowcy, zewnetrzne_id_zawodnika="MVC8zHZD")
simple_select_all("sportowcy", id_zawodnika=1) simple_select_all("sportowcy", id_zawodnika=1)
simple_select_all("kluby", ..., LIMIT=5, ORDER_BY="kluby.skrocona_nazwa")
https://stackoverflow.com/a/75316945 https://stackoverflow.com/a/75316945
Did they make it harder to query dynamically on purpose? ~Frank 19.11.2023 Did they make it harder to query dynamically on purpose? ~Frank 19.11.2023
@@ -187,18 +222,45 @@ class baza():
if not isinstance(entity_type, str): if not isinstance(entity_type, str):
entity_type = entity_type.__name__ entity_type = entity_type.__name__
# 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.
special_keywords = ("ORDER_BY", "ORDER_BY_DESC", "LIMIT")
special_args = {}
for arg in special_keywords:
if arg in kwargs:
special_args[arg] = kwargs[arg]
del kwargs[arg]
print(f"[{round(time.time())}] SELECT") print(f"[{round(time.time())}] SELECT")
results = ( results = (
self.session. self.session.
query(self.entities[entity_type]). query(self.entities[entity_type]).
filter_by(**kwargs). filter_by(**kwargs)
all()
) )
print(f"[{round(time.time())}] SELECT RESULTS: {results}") 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)
return results 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"])
results_objs = results.all()
print(f"[{round(time.time())}] SELECT RESULTS: {results_objs}")
return results_objs
@exit_gracefully @exit_gracefully
def simple_insert_one(self, entity_type, **kwargs): def simple_insert_one(self, entity_type, **kwargs):
@@ -213,6 +275,14 @@ class baza():
if not isinstance(entity_type, str): if not isinstance(entity_type, str):
entity_type = entity_type.__name__ entity_type = entity_type.__name__
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") print(f"[{round(time.time())}] INSERT")
obj = self.entities[entity_type](**kwargs) obj = self.entities[entity_type](**kwargs)

View File

@@ -1,8 +1,46 @@
from flask import render_template, request, make_response from flask import render_template, request, make_response
import lewy_api_v1
import lewy_db
import lewy_globals import lewy_globals
def get_lewy_stats():
return {
'all_time_stats': {
'goals': 380,
'assists': 120,
'matches': 450,
},
'club_stats': {
'goals': 132,
'assists': 112,
'matches': 245,
},
'nation_stats': {
'goals': 86,
'assists': 52,
'matches': 158,
},
'worldcup': {
'goals': 7,
'assists': 2,
'matches': 11,
},
'euro': {
'goals': 6,
'assists': 2,
'matches': 18,
},
'cards': {
'yellow': 24,
'red': 4,
}
}
def index(): def index():
dark_mode = request.cookies.get('darkMode', 'disabled') 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 = { stats = {
'goals': 38, 'goals': 38,
'assists': 12, 'assists': 12,
@@ -27,12 +65,39 @@ def mecze():
return render_template('matches.html', matches=matches) return render_template('matches.html', matches=matches)
def statystyki(): def statystyki():
stats = { dane=get_lewy_stats()
'goals': 38, return render_template('stats.html', **dane)
'assists': 12,
'matches': 45, def clubs():
selected_club = request.args.get("club","FC Barcelona")
clubs = [
{'club': 'FC Barcelona', 'goals': 22,'assist':12},
{'club': 'Bayern Monachium', 'goals': 132,'assist':12},
{'club': 'Borussia Dortmund', 'goals': 132,'assist':12},
{'club': 'Lech Poznan', 'goals': 132,'assist':12},
]
return render_template('club.html', clubs=clubs, selected_club=selected_club)
def representation():
nation_stats = {
'goals': 86,
'assists': 52,
'matches': 158,
} }
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(): def toggle_dark_mode():
# Przełącz tryb i zapisz w ciasteczku # Przełącz tryb i zapisz w ciasteczku

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -1,47 +1,57 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="pl"> <html lang="pl">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Lewandowski Stats{% endblock %}</title> <title>{% block title %}Lewandowski Stats{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<meta property="og:title" content="Robert Lewandowski Stats"> <meta property="og:title" content="Robert Lewandowski Stats">
<meta property="og:type" content="website" > <meta property="og:type" content="website">
<meta property="og:url" content="https://lewy.7o7.cx/" > <meta property="og:url" content="https://lewy.7o7.cx/">
<meta property="og:description" content="Najnowsze informacje o meczach, golach, asystach i innych statystykach"> <meta property="og:description" content="Najnowsze informacje o meczach, golach, asystach i innych statystykach">
<meta property="og:image" content="{{ url_for('static', filename='lewandowski.jpg') }}" > <meta property="og:image" content="{{ url_for('static', filename='lewandowski.jpg') }}">
<meta property="og:image:height" content = "143"> <meta property="og:image:height" content="143">
<meta property="og:image:width" content = "100"> <meta property="og:image:width" content="100">
</head> </head>
<body>
<nav class="navbar">
<div class="logo">Robert Lewandowski</div>
<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>
</ul>
<div class="hamburger"></div>
</nav>
<header> <body>
<header class="base-header">
<nav class="navbar">
<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="/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>
<div class="header-content"> <div class="header-content">
<center><img src="{{ url_for('static', filename='lewandowski.jpg') }}" alt="Robert Lewandowski" class="profile-image"></center> <div class="profile-image">
<h1>Statystyki Roberta Lewandowskiego</h1> <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></div>
</header> </header>
<main> <main>
{% block content %}{% endblock %} {% block content %}{% endblock %}
</main> </main>
<script> <script>
const hamburger = document.querySelector('.hamburger'); const hamburger = document.querySelector('.hamburger');
const navLinks = document.querySelector('.nav-links'); const navLinks = document.querySelector('.nav-links');
hamburger.addEventListener('click', () => { hamburger.addEventListener('click', () => {
navLinks.classList.toggle('show');}); navLinks.classList.toggle('show');
</script> });
</script>
<script> <script>
function toggleTheme() { function toggleTheme() {
const currentMode = document.body.classList.contains('poland-mode') ? 'poland' : 'fcb'; const currentMode = document.body.classList.contains('poland-mode') ? 'poland' : 'fcb';
@@ -59,8 +69,9 @@
</script> </script>
<!--!>Footer<--> <!--!>Footer<-->
<hr style='width: 50%'/> <hr style='width: 50%' />
{% block footer %}{% endblock %} {% block footer %}{% endblock %}
</body> </body>
</html>
</html>

View 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.goals }} </span>
</div>
<div class="stat-box">
<p>Łączny czas gry:</p> <span class="stat-box-special"> {{ stats.goals }}</span>
</div>
<div class="stat-box">
<p>Hat-tricki:</p> <span class="stat-box-special"> {{ stats.goals }}</span>
</div>
<div class="stat-box">
<p>Zwycięstwa:</p> <span class="stat-box-special"> {{ stats.goals }}</span>
</div>
<div class="stat-box">
<p>Porażki:</p> <span class="stat-box-special"> {{ stats.goals }}</span>
</div>
<div class="stat-box">
<p>Żółte kartki:</p> <span class="stat-box-special"> {{ stats.goals }}</span>
</div>
<div class="stat-box">
<p>Czerwone kartki:</p> <span class="stat-box-special"> {{ stats.goals }}</span>
</div>
</div>
</section>
{% endif %}
{% endfor %}
{% endblock %}
{% block footer %}
{{ commit_in_html | safe }}
{% endblock %}

View 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 %}

View File

@@ -3,13 +3,56 @@
{% block title %}Strona Główna{% endblock %} {% block title %}Strona Główna{% endblock %}
{% block content %} {% block content %}
<h2>Witaj na stronie poświęconej statystykom Roberta Lewandowskiego!</h2> <div class="main-index">
<p>Tu znajdziesz najnowsze informacje o meczach, golach, asystach i innych statystykach.</p> <h2>Witaj na stronie poświęconej <br> statystykom Roberta Lewandowskiego!</h2>
<div> <p>Tu znajdziesz najnowsze informacje o meczach, golach, asystach i innych statystykach.</p>
<h3>Ogólne statystyki:</h3> <section class="about-section">
<p>Gole: {{ goals }}</p> <article class="article__how-it-works">
<p>Asysty: {{ assists }}</p> <h3>Jak to działa?</h3>
<p>Liczba meczów: {{ matches }}</p> <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> </div>
{% endblock %} {% endblock %}

View File

@@ -3,23 +3,37 @@
{% block title %}Lista meczów{% endblock %} {% block title %}Lista meczów{% endblock %}
{% block content %} {% block content %}
<h2>📅 Mecze Roberta</h2> <select>
<table> <option disabled selected>Wybierz rok</option>
<tr> <option value="{{ url_for('compare', player='Leo Messi') }}">2024/2025</option>
<th>Data</th> <option value="{{ url_for('compare', player='Ronaldo') }}">2023/2024</option>
<th>Przeciwnik</th> <option value="{{ url_for('compare', player='Neymar') }}">2022/2023</option>
<th>Gole</th> <option value="{{ url_for('compare', player='Neymar') }}">2021/2022</option>
<th>Asysty</th> <option value="{{ url_for('compare', player='Neymar') }}">2020/2021</option>
<th>Minuty</th> <option value="{{ url_for('compare', player='Neymar') }}">2019/2020</option>
</tr> <option value="{{ url_for('compare', player='Neymar') }}">2018/2019</option>
{% for match in matches %} <option value="{{ url_for('compare', player='Neymar') }}">2017/2018</option>
<tr> <option value="{{ url_for('compare', player='Neymar') }}">2016/2017</option>
<td>{{ match.date }}</td> </select>
<td>{{ match.opponent }}</td> <section class="section__matches">
<td>{{ match.goals }}</td> <h2>📅 Mecze Roberta</h2>
<td>{{ match.assists }}</td> <table>
<td>{{ match.minutes }}</td> <tr>
</tr> <th>Data</th>
{% endfor %} <th>Przeciwnik</th>
</table> <th>Gole</th>
<th>Asysty</th>
<th>Minuty</th>
</tr>
{% for match in matches %}
<tr>
<td>{{ match.date }}</td>
<td>{{ match.opponent }}</td>
<td>{{ match.goals }}</td>
<td>{{ match.assists }}</td>
<td>{{ match.minutes }}</td>
</tr>
{% endfor %}
</table>
</section>
{% endblock %} {% endblock %}

View File

@@ -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.assist }} </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.goals }}</span>
</div>
<div class="stat-box">
<p>Hat-tricki:</p> <span class="stat-box-special"> {{ nation_stats.goals }}</span>
</div>
<div class="stat-box">
<p>Zwycięstwa:</p> <span class="stat-box-special"> {{ nation_stats.goals }}</span>
</div>
<div class="stat-box">
<p>Porażki:</p> <span class="stat-box-special"> {{ nation_stats.goals }}</span>
</div>
<div class="stat-box">
<p>Żółte kartki:</p> <span class="stat-box-special"> {{ nation_stats.goals }}</span>
</div>
<div class="stat-box">
<p>Czerwone kartki:</p> <span class="stat-box-special"> {{ nation_stats.goals }}</span>
</div>
</div>
</section>
{% endblock %}

View File

@@ -3,38 +3,104 @@
{% block title %}Statystyki{% endblock %} {% block title %}Statystyki{% endblock %}
{% block content %} {% block content %}
<section class="section-stats"> <div class="section-stats-center">
<h2>All time stats</h2>
<div class="stats"> <section class="section-stats">
<div class="stat-box"> <h2>Ogólne statystyki</h2>
<h3>{{ stats.goals }}</h3> <div class="stats">
<p>Goals</p> <div class="stat-box">
</div> <h3>{{ all_time_stats.goals }}</h3>
<div class="stat-box"> <p>Gole</p>
<h3>{{ stats.assists }}</h3> </div>
<p>Assists</p> <div class="stat-box">
</div> <h3>{{ all_time_stats.assists }}</h3>
<div class="stat-box"> <p>Asysty</p>
<h3>{{ stats.matches }}</h3> </div>
<p>Apps</p> <div class="stat-box">
</div> <h3>{{ all_time_stats.matches }}</h3>
<p>Występy</p>
</div>
</div>
</section>
<section class="section-stats">
<h2>Klubowe statystyki</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ club_stats.goals }}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ club_stats.assists }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<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>Mistrzostwa świata</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ worldcup.goals }}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ worldcup.assists }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<h3>{{ worldcup.matches }}</h3>
<p>Występy</p>
</div>
</div>
</section>
<section class="section-stats">
<h2>EURO</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ euro.goals }}</h3>
<p>Gole</p>
</div>
<div class="stat-box">
<h3>{{ euro.assists }}</h3>
<p>Asysty</p>
</div>
<div class="stat-box">
<h3>{{ euro.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> </div>
</section> </section>
<section class="section-stats"> {% endblock %}
<h2>All time stats</h2>
<div class="stats">
<div class="stat-box">
<h3>{{ stats.goals }}</h3>
<p>Goals</p>
</div>
<div class="stat-box">
<h3>{{ stats.assists }}</h3>
<p>Assists</p>
</div>
<div class="stat-box">
<h3>{{ stats.matches }}</h3>
<p>Apps</p>
</div>
</div>
</section>
{% endblock %}

View 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 %}