api fixes/updates
This commit is contained in:
@@ -29,6 +29,7 @@ class CreateAcarsTables extends Migration
|
||||
$table->unsignedInteger('gs')->nullable();
|
||||
$table->unsignedInteger('transponder')->nullable();
|
||||
$table->string('autopilot')->nullable();
|
||||
$table->decimal('fuel')->nullable();
|
||||
$table->decimal('fuel_flow')->nullable();
|
||||
$table->string('sim_time')->nullable();
|
||||
|
||||
|
||||
1075
app/Database/seeds/in_progress.yml
Normal file
1075
app/Database/seeds/in_progress.yml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -240,7 +240,8 @@ class PirepController extends Controller
|
||||
*/
|
||||
public function update($id, UpdateRequest $request)
|
||||
{
|
||||
Log::info('PIREP Update, user '.Auth::id(), $request->post());
|
||||
Log::info('PIREP Update, user '.Auth::id());
|
||||
Log::info($request->getContent());
|
||||
|
||||
$user = Auth::user();
|
||||
$pirep = Pirep::find($id);
|
||||
|
||||
@@ -26,12 +26,13 @@ class PositionRequest extends FormRequest
|
||||
'positions.*.lat' => 'required|numeric',
|
||||
'positions.*.lon' => 'required|numeric',
|
||||
'positions.*.altitude' => 'nullable|numeric',
|
||||
'positions.*.heading' => 'nullable|integer|between:0,360',
|
||||
'positions.*.heading' => 'nullable|numeric|between:0,360',
|
||||
'positions.*.vs' => 'nullable',
|
||||
'positions.*.gs' => 'nullable',
|
||||
'positions.*.transponder' => 'nullable',
|
||||
'positions.*.autopilot' => 'nullable',
|
||||
'positions.*.fuel_flow' => 'nullable',
|
||||
'positions.*.fuel' => 'nullable|numeric',
|
||||
'positions.*.fuel_flow' => 'nullable|numeric',
|
||||
'positions.*.log' => 'nullable',
|
||||
'positions.*.created_at' => 'nullable|date',
|
||||
];
|
||||
|
||||
@@ -43,9 +43,9 @@ class UpdateRequest extends FormRequest
|
||||
'notes' => 'nullable',
|
||||
'source_name' => 'nullable|max:25',
|
||||
'landing_rate' => 'nullable|numeric',
|
||||
'block_off_time' => 'nullable|date',
|
||||
'block_on_time' => 'nullable|date',
|
||||
'created_at' => 'nullable|date',
|
||||
'block_off_time' => 'nullable',
|
||||
'block_on_time' => 'nullable',
|
||||
'created_at' => 'nullable',
|
||||
'status' => 'nullable',
|
||||
'score' => 'nullable|integer',
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
||||
* @property integer block_time
|
||||
* @property integer flight_time In minutes
|
||||
* @property integer planned_flight_time
|
||||
* @property mixed planned_distance
|
||||
* @property mixed distance
|
||||
* @property integer score
|
||||
* @property User user
|
||||
* @property Flight|null flight
|
||||
@@ -105,11 +107,20 @@ class Pirep extends Model
|
||||
'score' => 'integer',
|
||||
'source' => 'integer',
|
||||
'state' => 'integer',
|
||||
'block_off_time' => 'datetime',
|
||||
'block_on_time' => 'datetime',
|
||||
'submitted_at' => 'datetime',
|
||||
#'block_off_time' => 'datetime',
|
||||
#'block_on_time' => 'datetime',
|
||||
#'submitted_at' => 'datetime',
|
||||
];
|
||||
|
||||
/*protected $dates = [
|
||||
'block_off_time',
|
||||
'block_on_time',
|
||||
'submitted_at',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at'
|
||||
];*/
|
||||
|
||||
public static $rules = [
|
||||
'airline_id' => 'required|exists:airlines,id',
|
||||
'aircraft_id' => 'required|exists:aircraft,id',
|
||||
@@ -140,6 +151,24 @@ class Pirep extends Model
|
||||
return $flight_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the block off time in carbon format
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getBlockOffTimeAttribute()
|
||||
{
|
||||
return new Carbon($this->attributes['block_off_time']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the block on time
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getBlockOnTimeAttribute()
|
||||
{
|
||||
return new Carbon($this->attributes['block_on_time']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new Length unit so conversions can be made
|
||||
* @return int|Distance
|
||||
@@ -236,16 +265,16 @@ class Pirep extends Model
|
||||
*/
|
||||
public function getProgressPercentAttribute()
|
||||
{
|
||||
$upper_bound = $this->flight_time;
|
||||
if($this->planned_flight_time) {
|
||||
$upper_bound = $this->planned_flight_time;
|
||||
$upper_bound = $this->distance['nmi'];
|
||||
if($this->planned_distance) {
|
||||
$upper_bound = $this->planned_distance['nmi'];
|
||||
}
|
||||
|
||||
if(!$upper_bound) {
|
||||
$upper_bound = 1;
|
||||
}
|
||||
|
||||
return round(($this->flight_time / $upper_bound) * 100, 0);
|
||||
return round(($this->distance['nmi'] / $upper_bound) * 100, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,7 @@ use App\Models\Setting;
|
||||
use App\Models\Subfleet;
|
||||
use App\Repositories\SettingRepository;
|
||||
use App\Services\ModuleService;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use View;
|
||||
@@ -27,6 +28,11 @@ class AppServiceProvider extends ServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
Schema::defaultStringLength(191);
|
||||
|
||||
Carbon::serializeUsing(function ($carbon) {
|
||||
return $carbon->format('U');
|
||||
});
|
||||
|
||||
$this->app->bind('setting', SettingRepository::class);
|
||||
|
||||
View::share('moduleSvc', app(ModuleService::class));
|
||||
@@ -39,6 +45,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
PirepField::observe(PirepFieldObserver::class);
|
||||
Setting::observe(SettingObserver::class);
|
||||
Subfleet::observe(SubfleetObserver::class);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user