Add bonuspoint, corr and chart calculation and update displaying of chart.

This commit is contained in:
2018-04-03 21:06:22 +02:00
parent f56cf04e74
commit 3ade0f043f
6 changed files with 249 additions and 8 deletions

View File

@@ -22,17 +22,17 @@ $username2 = '';
$username3 = '';
$username4 = '';
// Calculate rank total
$sql = 'SELECT
$sql = "SELECT
r.user_id,
u.username,
SUM(r.points) AS points_total
FROM ' . FOOTB_RANKS . ' AS r
(SELECT SUM(c.rank_total) FROM " . FOOTB_MY_CHART . " AS c WHERE c.user_id = (r.user_id) AND c.season = r.season AND c.league = r.league AND c.matchday = $matchday) AS points_total
FROM " . FOOTB_RANKS . ' AS r
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = r.user_id)
WHERE r.season = $season
AND r.league = $league
AND r.matchday <= $matchday
GROUP BY r.user_id
ORDER BY points_total DESC, LOWER(u.username) ASC";
ORDER BY points_total ASC, LOWER(u.username) ASC";
$result = $db->sql_query($sql);
$current_ranks = $db->sql_fetchrowset($result);
@@ -158,7 +158,7 @@ if ($total_users > 3 AND $total_users <= 50)
$ranks_dayl_1 = '';
$points_1 = '';
$sql = 'SELECT *
FROM ' . FOOTB_RANKS . "
FROM ' . FOOTB_MY_CHART . "
WHERE season = $season
AND league = $league
AND matchday <= $matchday
@@ -211,7 +211,7 @@ if ($total_users > 3 AND $total_users <= 50)
if ($user3 != 0)
{
$sql = 'SELECT *
FROM ' . FOOTB_RANKS . "
FROM ' . FOOTB_MY_CHART . "
WHERE season = $season
AND league = $league
AND matchday <= $matchday
@@ -238,7 +238,7 @@ if ($total_users > 3 AND $total_users <= 50)
if ($user4 != 0)
{
$sql = 'SELECT *
FROM ' . FOOTB_RANKS . "
FROM ' . FOOTB_MY_CHART . "
WHERE season = $season
AND league = $league
AND matchday <= $matchday
@@ -267,7 +267,7 @@ if ($total_users > 3 AND $total_users <= 50)
$sql = 'SELECT
MIN(points) As points_min,
MAX(points) As points_max
FROM ' . FOOTB_RANKS . "
FROM ' . FOOTB_MY_CHART . "
WHERE season = $season
AND league = $league
AND matchday <= $matchday