phpvms icon indicating copy to clipboard operation
phpvms copied to clipboard

Enhanced statistics

Open dotalchemy opened this issue 4 years ago • 2 comments

Enhanced pilot statistics

  • total nautical miles flown
  • total passengers flown
  • total cargo flown
  • total fuel usage
  • total earnings (airline, not personal)
  • total expenses
  • unique airports visited
  • unique countries visited

Perhaps the ability to drill down per aircraft type per user, see how many miles User X has flown in an A320, how many passengers they've flown in a 208, etc.

Airport statistics

  • total flights
  • total passengers
  • total freight
  • total fuel purchased

Airframe statistics (per tail number)

  • nautical miles flown
  • hours flown
  • passengers flown
  • freight flown
  • fuel used

The latter could expand into a maintenance module later down the road, where aircraft must have annual / 100hr inspections, perhaps even SMOH times on engines

Maybe monthly versions of the above items for graphing / trending / reporting?

dotalchemy avatar Sep 08 '20 21:09 dotalchemy

Just some thoughts/notes for me:

  • Have a generic stats collection class:
abstract class Stats {
  public $statName;  // Hold the stat name
  abstract function calculate(User $user): Stat;

  public function runCalculation(User $user) {
    // run the calculate() method
    $stat = $this->calculate($user);

    // sanity checks, insert into DB
  }
}

And a model/enum:

public class IntervalEnum {
  // minute, hourly, daily, monthly, yearly
}

public class Stat extends Model {
  public $fillable = ['name', 'interval-type', 'interval-time', 'value'];
}

Impl:

class TotalFlights extends Stats {
  public $statName = 'total-flights';

  public function calculate(User $user): Stat {
    $stat = new Stat(['interval-type' => IntervalEnum::$daily, 'interval-time' = Carbon::today()]);
    // calc..
    $stat->value = $user->total_flights;  // dumb... but return some kind of value

    return $stat;
  }
}

nabeelio avatar Sep 08 '20 22:09 nabeelio

more pilot statistics? Top pilots landing rating (Gs forces or vertical speed?) Top pilots hours Top pilots flights

avs-code avatar Sep 09 '20 00:09 avs-code