From 7baed89b6a2e2b1c7715286b584130f735cbc41a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=A7=D0=B5=D1=80=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Tue, 21 Apr 2026 11:44:58 +0300 Subject: [PATCH] =?UTF-8?q?1.=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20agent.py=202.=20=D0=BF=D0=BE=D0=BC=D0=B5=D0=BD=D1=8F?= =?UTF-8?q?=D0=BB=20=D1=8F=D0=B2=D0=BA=D0=B8=20=D0=B8=20=D0=BF=D0=B0=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=BE=D0=B7?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=BE=D0=B2=203.=20=D1=83=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=BB=20=D0=B8=D0=B7=20maches.html=20=D0=BE=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D1=80=D0=B0,=20=D0=B8=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=B3=D0=B0=D0=BB=D0=BE=D1=87=D0=BA?= =?UTF-8?q?=D1=83=20=D0=B7=D0=B0=D0=B2=D0=B5=D1=80=D1=88=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BC=D0=B0=D1=82=D1=87=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent.py | 4 +- app.py | 20 ++++++--- .../match_session_repository.cpython-312.pyc | Bin 8192 -> 9061 bytes repositories/match_session_repository.py | 42 ++++++++++++++++++ .../__pycache__/create_admin.cpython-312.pyc | Bin 2589 -> 2017 bytes scripts/create_admin.py | 12 +---- templates/matches.html | 24 ++++++---- 7 files changed, 75 insertions(+), 27 deletions(-) diff --git a/agent.py b/agent.py index c69c7b3..6707002 100644 --- a/agent.py +++ b/agent.py @@ -10,8 +10,8 @@ import requests import websockets VMIX_API = "http://127.0.0.1:8088/api" -# WS_BASE = "wss://hostname.tvstart.ru/ws/vmix-client" -WS_BASE = "ws://127.0.0.1:8000/ws/vmix-client" +WS_BASE = "wss://wfl.tvstart.ru/ws/vmix-client" +# WS_BASE = "ws://127.0.0.1:8000/ws/vmix-client" CLIENT_ID = f"vmix-{socket.gethostname().lower()}-{uuid.uuid4().hex[:6]}" POLL_INTERVAL = 3 diff --git a/app.py b/app.py index 04fa0a2..1e5dd2e 100644 --- a/app.py +++ b/app.py @@ -459,8 +459,15 @@ def admin_matches( request: Request, today_only: bool = Query(default=False), tour: str | None = Query(default=None), + hide_finished: str = Query(default="true"), ): - matches = list_matches_for_admin(today_only=today_only, tour=tour) + hide_finished_bool = str(hide_finished).lower() == "true" + + matches = list_matches_for_admin( + today_only=today_only, + tour=tour, + hide_finished=hide_finished_bool, + ) tours = list_available_tours() return templates.TemplateResponse( @@ -469,13 +476,14 @@ def admin_matches( context={ "matches": matches, "today_only": today_only, + "hide_finished": hide_finished_bool, "selected_tour": tour or "", "tours": tours, "current_user": getattr(request.state, "current_user", None), }, ) - - + + # @app.get("/admin/matches/{match_id}/select") # def select_match( # request: Request, match_id: int, operator_name: str = Form(default="") @@ -519,7 +527,7 @@ def select_match( session_row = create_match_session( match_id=match_id, - operator_name=operator_name.strip() or None, + operator_name=None, vmix_project_path=None, ) @@ -533,7 +541,7 @@ def select_match( match_id=match_id, session_token=session_token, details={ - "operator_name": operator_name.strip() or None, + "operator_name": None, }, ) @@ -1354,7 +1362,7 @@ EMPTY_PLAYER_FORMATION = { "number": " ", "number_lastname_amp_K": " ", "position": " ", - "photo": " ", + "photo": r"D:\Графика\ФУТБОЛ\Женская Суперлига 2026\Photo\EMPTY.png", } diff --git a/repositories/__pycache__/match_session_repository.cpython-312.pyc b/repositories/__pycache__/match_session_repository.cpython-312.pyc index 39fba5b307eb5a85e14a37a89812d9a96c957d2e..cd6c5b29d084f182eac4ed27cb5f624c279ba92a 100644 GIT binary patch delta 790 zcmY+BOK1~87{_Na`^al!9=q94n`BXHy0ML|RZ3x7O=_bNNhx}LC#Cz$fc(W+9c$0$COUTI{MDYPpJmus}+6sOHzwiG&=Dl?Gb3X81QM`cJ zlm0K|Z~96g24AnF5-_rozc#F5rR2qdl7Qi&48W9t4=s!1J{(*I<9-j|18e{H;84js zCE+mdyARFi`nw$!?G8fPE9*2Fw&+jo2W--Mv{P+{jBN3oF_)>#FA!tU=&+3@jp`@i zDlOhK=P(t-E{%+crZcIgDm5{qucyI_`nji+IO zMiTW6oO_S=FCuwF&zLgvC8oL2T=mt?m1&=mCyM@A_1FJ>-^7gR106bSa<)9pngWuDv!0 zSaMftr%g42#2FtQ^R>~mmi(vR1|-2bD7 z=Q4KXMrFb7GE(*=yY9kl38zfM8ZuG`FOV`w7oXnEV9Mke*C~#R91)Hl4wXY=u-T^r zgImHdh|bf!2iW2Db%rI-@X~GlRA5(DYi{L3DF4x&e51IG*P~I#Z-ugEm?Qrn}k0tIm2O5fAVO$wR3^RtAONq znxCicw&v#fU5Cgh3)$ZSdz)TOz8Ls@0cucd^nh5rrXQ}gC4R}BP^$&i24en`S9vNt RPB%oR8xl}se|WXE?q9=6xc>kE delta 274 zcmaFr*5JT*nwOW00SIoN*p>NJcp{$!2KczG$)vm|`$YliL;`x&&D9z#i?7=9?C<;~y05|1C Aa{vGU diff --git a/repositories/match_session_repository.py b/repositories/match_session_repository.py index 9ba0497..2ab5b7e 100644 --- a/repositories/match_session_repository.py +++ b/repositories/match_session_repository.py @@ -207,3 +207,45 @@ def list_available_tours(): return tours finally: conn.close() + +def list_matches_for_admin( + today_only: bool = False, + tour: str | None = None, + hide_finished: bool = True, +): + query = """ + SELECT + m.id, + m.external_id, + m.match_date, + m.status, + m.tour, + m.season, + ht.name AS home_team_name, + at.name AS away_team_name + FROM matches m + JOIN teams ht ON ht.id = m.home_team_id + JOIN teams at ON at.id = m.away_team_id + WHERE 1=1 + """ + params = [] + + if today_only: + query += " AND DATE(m.match_date) = CURRENT_DATE " + + if tour: + query += " AND m.tour = %s " + params.append(tour) + + if hide_finished: + query += " AND COALESCE(m.status, 'scheduled') <> 'finished' " + + query += " ORDER BY m.match_date ASC NULLS LAST, m.id ASC; " + + conn = get_connection() + try: + with conn.cursor() as cur: + cur.execute(query, params) + return cur.fetchall() + finally: + conn.close() \ No newline at end of file diff --git a/scripts/__pycache__/create_admin.cpython-312.pyc b/scripts/__pycache__/create_admin.cpython-312.pyc index 1a9135de311b0f6d2e3172584c9bcfb88a99bfac..00e7e561d3f62bc02904fbdd6dc7597ed9e44159 100644 GIT binary patch delta 362 zcmbO$@{phJG%qg~0}#j?KhHeLGLcV$@zX?gMU@nW6y_Y}T$U&nMut?zEU*%gG6cxt zotPjhicNwaD4~f}0-+nmO68b%LY9*yhclNeii?q9;vWlszVy_R_~iV&ywv29%>2B` zhKzEXw=wTvW@80vDq@*j!fwcQi=!a1xVSvOC}r|0cCE>5%xc^$xrv#1MPfiT+?$`W zdohaKV#+VR#avujT*M3%yv3A~1k`NJsgiI@v^ce>EHgQ^STC`(BqJWmD*~GjGT;_R ze0*MFZfbn|N`}usK0}cxSkxvrKczG$)vibx$YliL;s_w|ftit!@iqhJZ3eEp4AOTQ XWGA2G)M945>N>MUQbWu delta 1032 zcmbtS&rcIU82zTZJG(?6*7Ll;?q# z_dcHo*m(2yQ}Vk|Y-vOL#m+MY9i^}%A08?9VeT*;j&#cZY&vN*K9IpD5)tQxLTiZ3&~uOHMg5XXP!zmHc8yfdm{O$UebBGND^N z@ti%cHW_IoGebRsN~&taGrFphHb-;bp>d3KEn{lAw0?v1G0nNd)_qoL971Rt+}q&U zf$&%0mZc?WSy@unTxGE+mX)GXdL;%UKS0@mi@R7vcsFns1#6=Sc<-}^AGy#MUV3_~ K#sS}6KkhfBL(jMX diff --git a/scripts/create_admin.py b/scripts/create_admin.py index 6a397e3..6e7aed9 100644 --- a/scripts/create_admin.py +++ b/scripts/create_admin.py @@ -1,23 +1,13 @@ import os import sys from getpass import getpass +from db import get_connection sys.path.append(os.path.dirname(os.path.dirname(__file__))) -import psycopg2 from services.auth_service import hash_password -def get_connection(): - return psycopg2.connect( - host=os.getenv("DB_HOST", "localhost"), - port=os.getenv("DB_PORT", 5432), - dbname=os.getenv("DB_NAME", "wfl_db"), - user=os.getenv("DB_USER", "postgres"), - password=os.getenv("DB_PASSWORD", "159753"), - ) - - def main(): username = input("Username: ").strip() password = getpass("Password: ").strip() diff --git a/templates/matches.html b/templates/matches.html index 937ab57..f84d070 100644 --- a/templates/matches.html +++ b/templates/matches.html @@ -345,6 +345,21 @@ +
+ +
+ + + Завершенные матчи +
+
+
@@ -364,7 +379,6 @@ Тур Сезон Статус - Оператор Действие @@ -386,14 +400,8 @@ {{ status }} - +
-