Jump to content

Admin overview report


steelerboi

Recommended Posts

When logged in as admin and viewing the overview report (reports & expenses), my aircraft usage was showing weird hours and miles totals.

A quick delve into the StatsData.class.php showed that the sql query for AircraftUsage was using COUNT() rather than SUM(), i.e.

public static function AircraftUsage()
{
	$sql = 'SELECT a.name AS aircraft, a.registration, 
					SUM(p.flighttime) AS hours, SUM(p.distance) AS distance
				FROM '.TABLE_PREFIX.'pireps p
					INNER JOIN '.TABLE_PREFIX.'aircraft a ON p.aircraft = a.id
				GROUP BY p.aircraft';

I changed the query accordingly and the totals now show correct values.

Nabeel, was this the right thing to do, or was I missing something elsewhere ?

Link to comment
Share on other sites

  • 7 months later...

Ciao Nabeen,

since this post is allready open i'll use it.

regarding this feature :

Aircraft Usage Aircraft Hours and Usage

Aircraft Hours Miles

A320-200 (I-VVAB) 01:15:43 26508

ATR72 (I-VVAT)         00:03:28 761

B737-800 (I-VVBS) 01:22:53 27503

EMB-170 (I-VVEM) 00:23:10 6933

MD82 (I-VVMD) 00:54:38 19923

MD-11 (I-VVSG) 00:09:10 4471

version 813, i think there is still a problem.

Ffor example the ATR total time is 3 hours, but from this page it seems to be 3 minutes 28 seconds.

So other example, the B737, 27000 miles in 1.22 hours? ;)

Should be changed to 82 hours and 53 minutes (that is 60 hours + 22 and not 01:22)

Hope you understand my poor english :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...