From 02188fa948f355551c8baa1fae13b93906c3d90e Mon Sep 17 00:00:00 2001 From: Tony Ford <tonyford@strategy-investor.de> Date: Thu, 5 Sep 2024 14:12:50 +0200 Subject: [PATCH] Fehlerbehebung --- html/_layouts/default.php | 1 + html/assets/js/script.js | 4 ++-- html/functions/db_methods.php | 13 ++++++------- html/functions/get_statistikMID.php | 4 ++++ 4 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 html/functions/get_statistikMID.php diff --git a/html/_layouts/default.php b/html/_layouts/default.php index 51c60f3..b12f083 100644 --- a/html/_layouts/default.php +++ b/html/_layouts/default.php @@ -104,6 +104,7 @@ if( !empty($csv) ){ var ERGEBNISSE=json_load('functions/get_ergebnisse.php'); var STAT_SAISON=json_load('functions/get_statistik_by_saison.php?saison='+SAISON); var STAT_ALL=json_load('functions/get_statistik.php'); + var STAT_ALL_MID=json_load('functions/get_statistikMID.php'); STATISTIK_SAISON={}; var MEISTERTITEL=calculateAllPunktestand().map((a) => ( a[0].nt )); diff --git a/html/assets/js/script.js b/html/assets/js/script.js index b8f7e45..13f0b9b 100644 --- a/html/assets/js/script.js +++ b/html/assets/js/script.js @@ -427,12 +427,12 @@ function calculatePunktestand(saison,runde,show=true){ } H.Tp+=parseInt(v.TH); H.Tn+=parseInt(v.TA); H.Td=H.Tp-H.Tn; A.Tp+=parseInt(v.TA); A.Tn+=parseInt(v.TH); A.Td=A.Tp-A.Tn; - STAT_ALL.filter((b) => ( b.MID == v.MID && v.H == b.nt )).forEach( + STAT_ALL_MID.filter((b) => ( b.MID == v.MID && v.H == b.nt )).forEach( function(c){ H.Zwk+=c.Zwk*1; } ); - STAT_ALL.filter((b) => ( b.MID == v.MID && v.A == b.nt )).forEach( + STAT_ALL_MID.filter((b) => ( b.MID == v.MID && v.A == b.nt )).forEach( function(c){ A.Zwk+=c.Zwk*1; } diff --git a/html/functions/db_methods.php b/html/functions/db_methods.php index 6f3fc79..dd27c02 100644 --- a/html/functions/db_methods.php +++ b/html/functions/db_methods.php @@ -434,21 +434,20 @@ function db_getFromStatistik(){ } -function db_getFromStatistik2(){ +function db_getFromStatistikMID(){ $db=new db; - $sql='SELECT Statistik.MID, Statistik.SpielerID, Spieler.name, Spieler.nt, Spieler.attr, Spieler.age, Spieler.age_saison, Teams.id, Statistik.Tore, Statistik.Assists, Statistik.Zpos, Statistik.Zneg, Statistik.Zpos - Statistik.Zneg AS "Zwk", Spieler.face FROM Statistik - INNER JOIN Ergebnisse ON Ergebnisse.MID = Statistik.MID - LEFT JOIN Spieler ON Spieler.id = Statistik.SpielerID - LEFT JOIN Teams ON Teams.id = Spieler.teamID - GROUP BY SpielerID, MID'; + $sql='SELECT Statistik.MID, Spieler.nt, SUM(Statistik.Zpos) - SUM(Statistik.Zneg) AS "Zwk" FROM Statistik + INNER JOIN Spieler ON Spieler.id = Statistik.SpielerID + GROUP BY Statistik.MID, Spieler.nt'; $result = $db->query($sql); $ROW=Array(); while( $row = $result->fetch_assoc() ){ - $row['SpielerID']=bin2hex($row['SpielerID']); + //echo json_encode($row); + //$row['SpielerID']=bin2hex($row['SpielerID']); $ROW[]=$row; } diff --git a/html/functions/get_statistikMID.php b/html/functions/get_statistikMID.php new file mode 100644 index 0000000..0f7ade9 --- /dev/null +++ b/html/functions/get_statistikMID.php @@ -0,0 +1,4 @@ +--- +layout: query +--- +<?=json_encode( db_getFromStatistikMID())?> -- GitLab