Reorganized PIREP page
This commit is contained in:
@@ -32,6 +32,7 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
||||
* @property Carbon block_on_time
|
||||
* @property integer block_time
|
||||
* @property integer flight_time In minutes
|
||||
* @property integer planned_flight_time
|
||||
* @property User user
|
||||
* @property Flight|null flight
|
||||
* @property Collection fields
|
||||
@@ -212,6 +213,23 @@ class Pirep extends Model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the flight progress in a percent.
|
||||
*/
|
||||
public function getProgressPercentAttribute()
|
||||
{
|
||||
$upper_bound = $this->flight_time;
|
||||
if($this->planned_flight_time) {
|
||||
$upper_bound = $this->planned_flight_time;
|
||||
}
|
||||
|
||||
if(!$upper_bound) {
|
||||
$upper_bound = 1;
|
||||
}
|
||||
|
||||
return round(($this->flight_time / $upper_bound) * 100, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the flight, based on the PIREP flight info
|
||||
* @return Flight|null
|
||||
|
||||
Reference in New Issue
Block a user