diff --git a/html/_layouts/default.php b/html/_layouts/default.php index 51c60f3ce2d0be2c46100fc66ab981d22a5ff85e..b12f08324a54cbea057fbf852ee178576b55ba6b 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 b8f7e45023c8458a61bc68f89cc79fce6f364bcd..13f0b9b06215e959b9b2b0300ceb9263452ceced 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 6f3fc79b60e310d7141c94067f6bdbca8ed07fac..dd27c023d2fe6190a8c38dc1a166867b0e9b3c92 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 0000000000000000000000000000000000000000..0f7ade93a4afc147d8664eabcb6251c6579a2430 --- /dev/null +++ b/html/functions/get_statistikMID.php @@ -0,0 +1,4 @@ +--- +layout: query +--- +<?=json_encode( db_getFromStatistikMID())?>