Author Topic: stat tables in untraveled regions & systems  (Read 12892 times)

0 Members and 1 Guest are viewing this topic.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
stat tables in untraveled regions & systems
« on: May 23, 2018, 12:55:40 am »
http://tm.teresco.org/user/region.php?units=miles&u=yakra&rg=ESP-CL
                            Overall ESP-CL Region Statistics                           
Active SystemsActive + Preview Systems
Distance Traveled     0.00 of 0.00 miles (%) Rank: 5     0.00 of 0.00 miles (%) Rank: 5
Routes Drivenof 111 (%) Rank: 7of 150 (%) Rank: 7
Routes Clinchedof 111 (%) Rank: 7of 150 (%) Rank: 7

Routes Driven & Clinched should read "0 of 111 (0%) Rank: N/A", etc.
For Distance Traveled, note that my rank here is 5, not 7. There are 6 travelers listed in the table at the bottom of the page.

http://tm.teresco.org/user/system.php?units=miles&u=yakra&sys=espa
  System Statistics for Spain Autopista / Autovia 
Distance Traveled     0.00 of 8801.73 miles (0.00%) Rank: 17
Routes Traveledof 269 (0%)
Routes Clinchedof 269 (0%) Rank: 18

Distance Traveled: Per espa-all.csv there are 17 travelers on the espa system, so at 0 miles I would be tied for 18th place.
Routes Driven:
  • 0 of 269 (0%)
  • No rank is shown. (Same for a system I have traveled.)
  • This stat is "Driven" on region.php and "Traveled" on system.php. It should be consistent between the two. (Was it discussed & decided to move from "Driven" to "Traveled" once upon a time?)
Routes Clinched: 0 of 269 (0%) Rank: N/A
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: stat tables in untraveled regions & systems
« Reply #1 on: June 15, 2018, 03:30:47 pm »
Note also that region.php incorrectly reports 0 miles total in Active Systems and Active + Preview Systems.

See also:
http://travelmapping.net/user/region.php?units=miles&u=the_spui_ninja&rg=ME
http://travelmapping.net/user/region.php?units=miles&u=oscar&rg=GU
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4850
  • Last Login:Yesterday at 01:56:24 pm
Re: stat tables in untraveled regions & systems
« Reply #2 on: June 15, 2018, 03:57:33 pm »
There are a lot bugs like this......................

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: stat tables in untraveled regions & systems
« Reply #3 on: July 12, 2019, 06:25:41 pm »
Possibly related, possibly not:
http://forum.travelmapping.net/index.php?topic=2152
We'll have to keep an eye on the one thing as we fix the other thing...
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: stat tables in untraveled regions & systems
« Reply #4 on: July 20, 2019, 12:15:03 pm »
region.php

Why total mileage is listed as 0:
$activeTotalMileage = $row['totalActiveMileage'];
when
$row = tm_fetch_user_row_with_rank($activeClinchedRes, 'activeClinched');
when there is no actual user row to fetch in $activeClinchedRes.
Using a separate query to get total mileage before the main query that gets our results, similar to what's done elsewhere on the site, should clear this up.

Why Distance Traveled Rank is n out of n travelers:
In tm_fetch_user_row_with_rank, the while loop is executed 8 times, once for each traveler. $rank is set to $nextRank for values of 1 to 8 inclusive.

Why Routes Traveled/Clinched Rank is n+1 out of n travelers:
If I query
SELECT traveler, SUM(cr.clinched) AS clinched, ROUND(sum(cr.clinched) / 112 * 100, 2) as clinchedPct FROM routes AS r LEFT JOIN clinchedRoutes AS cr ON cr.route = r.root LEFT JOIN systems ON r.systemName = systems.systemName WHERE (r.region = 'ESP-CT' AND systems.level = 'active') GROUP BY traveler ORDER BY clinched DESC;
I get an extra 9th row in my results where all fields are NULL, allowing for one more iteration of the while loop in tm_fetch_user_row_with_rank.
Changing the first LEFT JOIN to a RIGHT JOIN eliminates this extra row. (Do we want to do this?)
Technically, I am in a 238-way tie for 9th place here, along with everyone else traveling 0 routes. Do we prefer to present this information that way, or as N/A as suggested in the OP?
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: stat tables in untraveled regions & systems
« Reply #5 on: July 22, 2019, 01:36:56 pm »
work in progress

region2.php
Total mileage acquired first via separate query, instead of from $row['totalActiveMileage'] after tm_fetch_user_row_with_rank.
Fixes bug where total mileage is shown as 0.00.

region3.php
Mileage percentages no longer acquired from $row after tm_fetch_user_row_with_rank. PHP divides clinched mileage by total mileage and echoes that instead.
Distance Traveled percentage now shown as "(0%)" rather than "(%)".

region4.php
SQL queries simplified; no more 'activePercentage' field or LEFT JOIN.
TravelerInfo arrays simplified; no more mileage percentages. PHP divides clinched mileage by total mileage and echoes that instead.
Check if ($row['traveler'] != ""), and if not, $activePreviewMileageRank = "N/A";

region5.php
Routes Traveled/Clinched percentages no longer acquired from $row after tm_fetch_user_row_with_rank. PHP divides Traveled/Clinched count by total number and echoes that instead.
Now shown as "(0%)" rather than "(%)".

region6.php
Check if ($row['traveler'] != ""), and if not, Traveled/Clinched Routes set to 0, with Rank as "N/A".

system2.php
Check if ($row['traveler'] != ""), and if not, $rank = "N/A";

system3.php
Check if ($row['traveler'] != ""), and if not, Traveled/Clinched Routes set to 0, with Rank as "N/A".
« Last Edit: July 22, 2019, 04:28:24 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: stat tables in untraveled regions & systems
« Reply #6 on: July 22, 2019, 04:55:10 pm »
https://github.com/TravelMapping/Web/pull/334
Changes are live on lab2 for those who wish to test them out.
« Last Edit: July 22, 2019, 05:36:04 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca