Closed twincessna340a closed 13 years ago
Where is this and from what function?
Totally forgot this was an addon....I'll move it back to the forums.
Well it could be getting data from a StatsData function, so could be an API issue, I will check it out too
Ok, it is from AFVA | Mitchell's Fleet Table Addon. I have the latest version (v2.0)
Do you know which function he is calling to set the $fleet variable? I don't have his code
$fleet = self::FleetInfo()
public static function FleetInfo() { $sql = 'SELECT a._, a.name AS aircraft, COUNT(p.pirepid) AS routesflown, SUM(p.distance) AS distance, SEC_TO_TIME(SUM(p.flighttime_60*60)) AS totaltime, AVG(p.distance) AS averagedistance, AVG(p.flighttime) as averagetime FROM '.TABLE_PREFIX.'aircraft a LEFT OUTER JOIN '.TABLE_PREFIX.'pireps p ON (p.aircraft = a.id) GROUP BY a.registration';
return DB::get_results($sql);
DB::debug();
return $ret;
}
Changed "SEC_TO_TIME(SUM(p.flighttime_60_60))" to "SEC_TO_TIME(SUM(TIME_TO_SEC(p.flighttime_stamp)))" as currently coded in StatsData (beta 152) and it works 100%.
<?php foreach ($fleet as $aircraft) { ?> <?php echo $aircraft->totaltime; ?>
Ex. 58.54 returns 34:48