Skip to content

Commit 270b6d0

Browse files
committed
Fix Route Import Edge Case Bug
1 parent a79b1fe commit 270b6d0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

classes/controllers/admin/AdminRoutesController.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,17 @@ private function import_choose()
225225
private function import_import()
226226
{
227227
$routes = Json::decode(Input::get('rJson'));
228-
$count = count($routes);
228+
229+
$uniqueaircraft = [];
230+
foreach ($routes as $r) {
231+
foreach ($r['aircraftids'] as $a) {
232+
if (!in_array($a, $uniqueaircraft)) {
233+
$uniqueaircraft[] = $a;
234+
}
235+
}
236+
}
237+
$count = count($uniqueaircraft);
238+
229239
$db = DB::getInstance();
230240

231241
$db->query("DELETE FROM route_aircraft WHERE NOT routeid IN (SELECT id FROM routes)");

0 commit comments

Comments
 (0)