Author Topic: Incorrect total mileage calculation  (Read 9036 times)

0 Members and 1 Guest are viewing this topic.

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:Yesterday at 12:52:03 pm
Incorrect total mileage calculation
« on: September 10, 2016, 04:32:49 am »
There's a problem that some system mileage is more than the corresponding region mileage: http://tm.teresco.org/user/?u=cinx

The total mileage (preview+active) of the BIH region is 2238.76mi.
The total mileage of bihm system is 2275.34mi though!

The total mileage of the LTU region is 1166.80mi.
The total mileage of ltua system is 1185.63mi though!

The total mileage of the MKD region is 536.59mi.
The total mileage of mkda system is 557.95mi though!

The total mileage of the MLT region is 110.92mi.
The total mileage of mltt system is 113.49mi though!

Offline si404

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2067
  • Last Login:Today at 11:08:56 am
Re: Incorrect total mileage calculation
« Reply #1 on: September 10, 2016, 06:05:40 am »
Is system mileage not removing concurrencies, but region mileage is?

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:Yesterday at 12:52:03 pm
Re: Incorrect total mileage calculation
« Reply #2 on: September 10, 2016, 06:47:05 am »
If it is, I think it's not a feature but a bug...

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1767
  • Last Login:Yesterday at 12:05:27 pm
Re: Incorrect total mileage calculation
« Reply #3 on: September 10, 2016, 08:35:19 am »
This has been the case for a while...thought someone already reported it.

Another example: I have 1148.52 mi on Quebec freeways in Quebec but only 1120.02 mi in Quebec overall. I added my total mileage for each of the individual routes in the set and got 1148.50, so it obviously isn't accounting for some/all concurrencies (the A-20 and A-55 have a concurrency of around 37 km / 23 mi).
Clinched:

Online Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Today at 01:00:17 pm
Re: Incorrect total mileage calculation
« Reply #4 on: December 20, 2016, 09:23:20 pm »
OK, so the problem is in the SQL query in user/index.php, which attempts to compute the total system mileage by adding up all the routes in the system, not taking into account concurrencies. It looks to me like the stats generated by the site update in the logs directory are correct.  So I think we're good with the site update program itself.  I will see if I can come up with an SQL query that will get the correct sum from the existing DB info, or if I need to put more into the DB to get this right.

Online Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Today at 01:00:17 pm
Re: Incorrect total mileage calculation
« Reply #5 on: December 20, 2016, 10:54:48 pm »
I think I've got this one fixed and live on the site.  Fortunately, everything needed was there in the DB.

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:Yesterday at 12:52:03 pm
Re: Incorrect total mileage calculation
« Reply #6 on: December 21, 2016, 04:01:00 am »
Thanks, I've checked all calculations (see first post), and I think it's OK now.

The total mileage of the MLT region is 110.92mi.
The total mileage of mltt system is 113.49mi though!

Both have 110.92mi now :)

Online Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Today at 01:00:17 pm
Re: Incorrect total mileage calculation
« Reply #7 on: December 21, 2016, 09:26:19 am »
Looks like some larger systems are way off.  Definitely some things be counted multiple times.  (See other related thread.)  I'm looking at it.

Online Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Today at 01:00:17 pm
Re: Incorrect total mileage calculation
« Reply #8 on: December 21, 2016, 10:00:06 am »
Think I got it now.  Let me know.

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1767
  • Last Login:Yesterday at 12:05:27 pm
Re: Incorrect total mileage calculation
« Reply #9 on: December 21, 2016, 10:05:01 am »
Mine look good.
Clinched:

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:Yesterday at 12:52:03 pm
Re: Incorrect total mileage calculation
« Reply #10 on: December 21, 2016, 10:24:02 am »
The small systems mentioned are still fine :)