diff --git a/user/region.php b/user/region.php index 4af917c..3121f7f 100644 --- a/user/region.php +++ b/user/region.php @@ -178,16 +178,16 @@ function redirect($link) { JOIN listEntries le ON co.traveler = le.traveler WHERE co.region = '$region' AND co.activeMileage > 0 GROUP BY co.traveler, le.includeInRanks - ORDER BY activeClinched DESC; + ORDER BY activeClinched DESC, le.includeInRanks DESC; SQL; $activeClinchedRes = tmdb_query($sql_command); $row = tm_fetch_user_row_with_rank($activeClinchedRes, 'activeClinched'); // $link = "redirect('/user/mapview.php?u=" . $tmuser . "&rg=" . $region . "')"; $activeClinchedMileage = $row['activeClinched']; if ($row['traveler'] != "" && $row['includeInRanks'] == "1") { - $activeMileageRank = $row['rank']; + $activeMileageRank = "Rank: ".$row['rank']; } else { - $activeMileageRank = "N/A"; + $activeMileageRank = ""; } // build arrays that will form the contents of the travelers @@ -196,6 +196,7 @@ function redirect($link) { $activeClinchedRes->data_seek(0); while ($row = $activeClinchedRes->fetch_assoc()) { $activeTravelerInfo[$row['traveler']]['activeClinched'] = $row['activeClinched']; + $activeTravelerInfo[$row['traveler']]['includeInRanks'] = $row['includeInRanks']; } // and active+preview @@ -208,16 +209,16 @@ function redirect($link) { JOIN listEntries le ON co.traveler = le.traveler WHERE co.region = '$region' AND co.activePreviewMileage > 0 GROUP BY co.traveler, le.includeInRanks - ORDER BY activePreviewClinched DESC; + ORDER BY activePreviewClinched DESC, le.includeInRanks DESC; SQL; $activePreviewClinchedRes = tmdb_query($sql_command); $row = tm_fetch_user_row_with_rank($activePreviewClinchedRes, 'activePreviewClinched'); // $link = "redirect('/user/mapview.php?u=" . $tmuser . "&rg=" . $region . "')"; $activePreviewClinchedMileage = $row['activePreviewClinched']; if ($row['traveler'] != "" && $row['includeInRanks'] == "1") { - $activePreviewMileageRank = $row['rank']; + $activePreviewMileageRank = "Rank: ".$row['rank']; } else { - $activePreviewMileageRank = "N/A"; + $activePreviewMileageRank = ""; } // build arrays that will form the contents of the travelers @@ -226,17 +227,18 @@ function redirect($link) { $activePreviewClinchedRes->data_seek(0); while ($row = $activePreviewClinchedRes->fetch_assoc()) { $activePreviewTravelerInfo[$row['traveler']]['activePreviewClinched'] = $row['activePreviewClinched']; + $activePreviewTravelerInfo[$row['traveler']]['includeInRanks'] = $row['includeInRanks']; } echo "Distance Traveled"; $style = 'style="background-color: '.tm_color_for_amount_traveled($activeClinchedMileage,$activeTotalMileage).';"'; echo "" . tm_convert_distance($activeClinchedMileage); echo " of " . tm_convert_distance($activeTotalMileage) . " " . $tmunits . " (" . tm_percent($activeClinchedMileage, $activeTotalMileage) . "%) "; - echo "Rank: " . $activeMileageRank . ""; + echo $activeMileageRank . ""; $style = 'style="background-color: '.tm_color_for_amount_traveled($activePreviewClinchedMileage,$activePreviewTotalMileage).';"'; echo "" . tm_convert_distance($activePreviewClinchedMileage); echo " of " . tm_convert_distance($activePreviewTotalMileage) . " " .$tmunits . " (" . tm_percent($activePreviewClinchedMileage, $activePreviewTotalMileage) . "%) "; - echo "Rank: " . $activePreviewMileageRank . ""; + echo $activePreviewMileageRank . ""; echo ""; // Second, fetch routes clinched/driven @@ -309,10 +311,10 @@ function redirect($link) { $row = tm_fetch_user_row_with_rank($activeClinchedRes, 'clinched'); if ($row['traveler'] != "" && $row['includeInRanks'] == "1") { $clinchedActiveRoutes = $row['clinched']; - $clinchedActiveRoutesRank = $row['rank']; + $clinchedActiveRoutesRank = "Rank: ".$row['rank']; } else { $clinchedActiveRoutes = 0; - $clinchedActiveRoutesRank = "N/A"; + $clinchedActiveRoutesRank = ""; } // Active only, driven @@ -378,10 +380,10 @@ function redirect($link) { $row = tm_fetch_user_row_with_rank($activeDrivenRes, 'driven'); if ($row['traveler'] != "" && $row['includeInRanks'] == "1") { $drivenActiveRoutes = $row['driven']; - $drivenActiveRoutesRank = $row['rank']; + $drivenActiveRoutesRank = "Rank: ".$row['rank']; } else { $drivenActiveRoutes = 0; - $drivenActiveRoutesRank = "N/A"; + $drivenActiveRoutesRank = ""; } // add to the table of travelers by region stats @@ -457,10 +459,10 @@ function redirect($link) { $row = tm_fetch_user_row_with_rank($activePreviewClinchedRes, 'clinched'); if ($row['traveler'] != "" && $row['includeInRanks'] == "1") { $clinchedActivePreviewRoutes = $row['clinched']; - $clinchedActivePreviewRoutesRank = $row['rank']; + $clinchedActivePreviewRoutesRank = "Rank: ".$row['rank']; } else { $clinchedActivePreviewRoutes = 0; - $clinchedActivePreviewRoutesRank = "N/A"; + $clinchedActivePreviewRoutesRank = ""; } // Active+Preview, driven @@ -526,10 +528,10 @@ function redirect($link) { $row = tm_fetch_user_row_with_rank($activePreviewDrivenRes, 'driven'); if ($row['traveler'] != "") { $drivenActivePreviewRoutes = $row['driven']; - $drivenActivePreviewRoutesRank = $row['rank']; + $drivenActivePreviewRoutesRank = "Rank: ".$row['rank']; } else { $drivenActivePreviewRoutes = 0; - $drivenActivePreviewRoutesRank = "N/A"; + $drivenActivePreviewRoutesRank = ""; } // add to the table of travelers by region stats @@ -544,17 +546,17 @@ function redirect($link) { echo ""; echo "Routes Traveled"; $style = 'style="background-color: '.tm_color_for_amount_traveled($drivenActiveRoutes,$totalActiveRoutes).';"'; - echo "".$drivenActiveRoutes." of " . $totalActiveRoutes . " (". tm_percent($drivenActiveRoutes, $totalActiveRoutes) . "%) Rank: ".$drivenActiveRoutesRank.""; + echo "".$drivenActiveRoutes." of " . $totalActiveRoutes . " (". tm_percent($drivenActiveRoutes, $totalActiveRoutes) . "%) ".$drivenActiveRoutesRank.""; $style = 'style="background-color: '.tm_color_for_amount_traveled($drivenActivePreviewRoutes,$totalActivePreviewRoutes).';"'; - echo "".$drivenActivePreviewRoutes." of " . $totalActivePreviewRoutes . " (" . tm_percent($drivenActivePreviewRoutes, $totalActivePreviewRoutes, 2) . "%) Rank: ".$drivenActivePreviewRoutesRank.""; + echo "".$drivenActivePreviewRoutes." of " . $totalActivePreviewRoutes . " (" . tm_percent($drivenActivePreviewRoutes, $totalActivePreviewRoutes, 2) . "%) ".$drivenActivePreviewRoutesRank.""; echo ""; echo ""; echo "Routes Clinched"; $style = 'style="background-color: '.tm_color_for_amount_traveled($clinchedActiveRoutes,$totalActiveRoutes).';"'; - echo "".$clinchedActiveRoutes." of " . $totalActiveRoutes . " (" . tm_percent($clinchedActiveRoutes, $totalActiveRoutes) . "%) Rank: ". $clinchedActiveRoutesRank.""; + echo "".$clinchedActiveRoutes." of " . $totalActiveRoutes . " (" . tm_percent($clinchedActiveRoutes, $totalActiveRoutes) . "%) ". $clinchedActiveRoutesRank.""; $style = 'style="background-color: '.tm_color_for_amount_traveled($clinchedActivePreviewRoutes,$totalActivePreviewRoutes).';"'; - echo "".$clinchedActivePreviewRoutes." of " . $totalActivePreviewRoutes . " (" . tm_percent($clinchedActivePreviewRoutes, $totalActivePreviewRoutes) . "%) Rank: ". $clinchedActivePreviewRoutesRank.""; + echo "".$clinchedActivePreviewRoutes." of " . $totalActivePreviewRoutes . " (" . tm_percent($clinchedActivePreviewRoutes, $totalActivePreviewRoutes) . "%) ". $clinchedActivePreviewRoutesRank.""; echo ""; ?> @@ -669,6 +671,7 @@ function redirect($link) { "; - echo "".$tie_rank.""; + echo "".$show_rank.""; echo "".$traveler.""; echo "".tm_convert_distance($stats['activeClinched']).""; $pct = round($stats['activeClinched'] / $activeTotalMileage * 100, 2); @@ -707,6 +717,7 @@ function redirect($link) { "; - echo "".$tie_rank.""; + echo "".$show_rank.""; echo "".$traveler.""; echo "".tm_convert_distance($stats['activePreviewClinched']).""; $pct = round($stats['activePreviewClinched'] / $activePreviewTotalMileage * 100, 2);