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

0 Members and 1 Guest are viewing this topic.

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4555
  • Last Login:Yesterday at 04:04:16 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!

Online si404

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1948
  • Last Login:Today at 12:56:44 pm
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: 4555
  • Last Login:Yesterday at 04:04:16 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: 1627
  • Last Login:Today at 10:09:32 am
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:

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
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.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
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: 4555
  • Last Login:Yesterday at 04:04:16 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 :)

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
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.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
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: 1627
  • Last Login:Today at 10:09:32 am
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: 4555
  • Last Login:Yesterday at 04:04:16 pm
Re: Incorrect total mileage calculation
« Reply #10 on: December 21, 2016, 10:24:02 am »
The small systems mentioned are still fine :)