Jump to content

Recommended Posts

Guest CableGuy
Posted

Humm, Just do a bit of thinking and you can do it all from php. First you have to select the pilot from the table, then select all aircraft from the table where pilotid = "Pilot id",then find all of the planes that pilot has flown, and calculate the hours for each aircraft. If it seems a bit confusing ill expain better, its just hard for me to type in my current condition.

  • Administrators
Posted

Or you can use the API. Don't do manual queries, chances are 99% you can do it all without touching the API.

I'm re-vamping for statistics, to add a flexible query system like I added for PIREPS and Schedules and Pilots, but for now, you can do this (which actually is using the PIREP query system, this shows how flexible it is)

<?php
$params = array(
   'p.pilotid' => [pilotid],
   'p.registration' => [aircraft registration],
);

// Look for the last 24 months
$totals = PIREPData::getIntervalDataByMonth($params, 24);

$flown_time = 0;
foreach($totals as $total)
{
   $flown_time = Util::AddTime($flown_time, $total->total);
}

echo 'Total time flown: '.$flown_time;

It'll be a bit slow, but I'm working on better functions for statistics as part of the cleanup. It might not work completely, but I'll let you figure out the pieces. You can put that in a loop for each aircraft

Posted

What does the Pie Chart show anyway?  I show on my own stats 2 flights for a total of 1.32 hours in my pilot center.  But when I go to My Stats, the Pie Chart shows 0.92 of 0.92 and 100% of 100%??  Is the pie chart showing flight time or something and the pilot center showing total time??

  • Administrators
Posted

What does the Pie Chart show anyway?  I show on my own stats 2 flights for a total of 1.32 hours in my pilot center.  But when I go to My Stats, the Pie Chart shows 0.92 of 0.92 and 100% of 100%??  Is the pie chart showing flight time or something and the pilot center showing total time??

Yes, shows the flight time per aircraft for that pilot. Are the times not adding up? The times might be a little different, due to the fact that the stats counter is using mysql to add up the times, whereas I do it manually. It shouldn't differ too much, though.

Which actually bring me back to the OP's question:

$flown_counts = StatsData::pilotAircraftFlownCounts($pilotid);

Do a print_r($flown_counts), that will return loads of information, per-aircraft. Chances are, what you're looking for is probably in there

Posted

Ok Nabeel, just so I understand......the time it shows in the Pilot Center is correct; 1.32 hours.  Which is 1 hour and 32 minutes.  Now, the pie chart comes up with a value of .92!  Now I can see where 1 hour(60 mins) + 32mins makes 1.32 hours.......but why does the pie chart show it like a 100 minute clock value of 0.92!?  I have only used ONE aircraft so far, so should it not also show 1.32 in the pie chart?!  Or is there some setting I need to change?!

Also, I have no idea where that code would go, that you mentioned, sorry.

  • Administrators
Posted

Because the pie chart doesn't really handle times, it just doing it as a fraction of a number, not a 60-minute time interval. The overall ratio should be correct.

The code, well, I guess the OP wanted it for a module

  • 5 years later...

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...