Skip to content

Commit

Permalink
fix(AirportImport): fix majority of airports not importing
Browse files Browse the repository at this point in the history
Initially, only coordinates with 6 decimals where accepted, now it's increased to 10
  • Loading branch information
daveroverts committed Jan 2, 2022
1 parent 6e2f000 commit 492cfec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/Http/Requests/Airport/Admin/StoreAirport.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function rules()
'icao' => 'required:string|unique:airports|size:4',
'iata' => 'required:string|unique:airports,iata|size:3',
'name' => 'required:string',
'latitude' => ['required', 'regex:/^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,6})?))$/'],
'longitude' => ['required', 'regex:/^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,6})?))$/'],
'latitude' => ['required', 'regex:/^[-]?((([0-8]?[0-9])(\.(\d{1,10}))?)|(90(\.0+)?))$/'],
'longitude' => ['required', 'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))(\.(\d{1,10}))?)|180(\.0+)?)/'],
];
}

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Requests/Airport/Admin/UpdateAirport.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function rules()
'icao' => 'required:string|between:4,4',
'iata' => 'required:string|between:3,3',
'name' => 'required:string',
'latitude' => ['required', 'regex:/^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,6})?))$/'],
'longitude' => ['required', 'regex:/^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,6})?))$/'],
'latitude' => ['required', 'regex:/^[-]?((([0-8]?[0-9])(\.(\d{1,10}))?)|(90(\.0+)?))$/'],
'longitude' => ['required', 'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))(\.(\d{1,10}))?)|180(\.0+)?)/'],
];
}

Expand Down
4 changes: 2 additions & 2 deletions app/Imports/AirportsImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function rules(): array
'icao' => ['required', 'string', Rule::unique('airports', 'icao')],
'iata' => ['required', 'string', Rule::unique('airports', 'iata')],
'name' => ['required', 'string'],
'lat' => ['required', 'regex:/^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,6})?))$/'],
'lon' => ['required', 'regex:/^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,6})?))$/'],
'lat' => ['required', 'regex:/^[-]?((([0-8]?[0-9])(\.(\d{1,10}))?)|(90(\.0+)?))$/'],
'lon' => ['required', 'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))(\.(\d{1,10}))?)|180(\.0+)?)/'],
];
}

Expand Down

0 comments on commit 492cfec

Please sign in to comment.