From 6b9ebb0d1ab858667d1b5c8da2fae0220a30b72f Mon Sep 17 00:00:00 2001 From: Julian Date: Mon, 19 Feb 2018 21:56:29 +0100 Subject: [PATCH] Football functions.php angepasst, damit ertippte Punkte bei ihren jeweiligen Teams als Tore eingetragen werden. --- includes/functions.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/includes/functions.php b/includes/functions.php index 5ce8220..daf4622 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -254,6 +254,7 @@ function save_ranking_matchday($season, $league, $matchday, $cash = false) } $i++; } + $league2 = $league + 50; foreach( $ranking_ary AS $curr_user => $curr_rank) { if ( round($money[$curr_rank['rank']] / $equal_rank[$curr_rank['rank']], 2) <> 0 ) @@ -282,6 +283,25 @@ function save_ranking_matchday($season, $league, $matchday, $cash = false) ,0 )"; $db->sql_query($sql); + if ($league < 51) + { + $curr_rank_points = $curr_rank['points']; + $curr_rank_user = $curr_rank['user_id'] + 2000; + $sql = 'UPDATE ' . FOOTB_MATCHES . " + SET goals_home = $curr_rank_points, + status = $matchday_status + WHERE season = $season AND league = $league2 AND matchday = $matchday AND team_id_home = $curr_rank_user"; + $db->sql_query($sql); + $sql = 'UPDATE ' . FOOTB_MATCHES . " + SET goals_guest = $curr_rank_points, + status = $matchday_status + WHERE season = $season AND league = $league2 AND matchday = $matchday AND team_id_guest = $curr_rank_user"; + $db->sql_query($sql); + $sql = 'UPDATE ' . FOOTB_MATCHDAYS . " + SET status = $matchday_status + WHERE season = $season AND league = $league2 AND matchday = $matchday"; + $db->sql_query($sql); + } } if ( sizeof($ranking_ary) == 0 ) { @@ -290,6 +310,15 @@ function save_ranking_matchday($season, $league, $matchday, $cash = false) AND league = $league AND matchday = $matchday"; $db->sql_query($sql); + if ($league < 51) + { + $sql = 'UPDATE ' . FOOTB_MATCHES . " + SET goals_home = '', + goals_guest = '', + status = $matchday_status + WHERE season = $season AND league = $league2 AND matchday = $matchday;"; + $db->sql_query($sql); + } } else { @@ -1033,7 +1062,8 @@ function current_league($season) $sql = 'SELECT DISTINCT m.league FROM ' . FOOTB_MATCHES . ' AS m INNER JOIN ' . FOOTB_BETS . ' AS b ON (b.season = m.season AND b.league = m.league ' . $user_spec . ") - WHERE m.season = $season + WHERE m.season = $season + AND league < 51 AND m.status in (0,1,2) ORDER BY m.match_datetime ASC LIMIT 1";