Compare commits
3 Commits
e3a4f87fe4
...
1c05de0af5
Author | SHA1 | Date | |
---|---|---|---|
1c05de0af5 | |||
309d9aab39 | |||
7cb6030387 |
@@ -63,6 +63,40 @@ export function drawDraftingBoard() {
|
||||
return leg;
|
||||
});
|
||||
|
||||
display_legs = display_legs.toSorted((leg_a, leg_b) => {
|
||||
if (leg_a.origin_location_id == leg_b.origin_location_id) {
|
||||
if (leg_a.origin_location.departure > leg_b.origin_location.departure) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if (leg_a.destination_location_id == leg_b.destination_location_id) {
|
||||
if (leg_a.destination_location.arrival > leg_b.destination_location.arrival) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if (leg_a.destination_location_id == leg_b.origin_location_id) {
|
||||
if (leg_a.destination_location.arrival > leg_b.origin_location.departure) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if (leg_a.origin_location_id == leg_b.destination_location_id) {
|
||||
if (leg_a.origin_location.departure > leg_b.destination_location.arrival) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (leg_a.origin_location.departure > leg_b.origin_location.departure) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let rows = display_legs.length;
|
||||
|
||||
element_board.style.setProperty("--drafting-board-number-locations", display_locations.length);
|
||||
@@ -161,6 +195,9 @@ export function getLocationWithLeastInboundTrips(locations, legs) {
|
||||
let n_a = numberOfInboundLegs(location_a);
|
||||
let n_b = numberOfInboundLegs(location_b);
|
||||
|
||||
// 1: b vor a
|
||||
// -1: a vor b
|
||||
|
||||
if (n_a == n_b) {
|
||||
return 0;
|
||||
} else if (n_a > n_b) {
|
||||
|
@@ -9,6 +9,7 @@ export function displayTripDetails(trip_id) {
|
||||
element_trip_details.popupShow();
|
||||
|
||||
fetchTrip(trip_id).then(result => {
|
||||
window.dataStore.trips.remember(result.trip);
|
||||
element_response.innerText = "";
|
||||
|
||||
let el_headline = EL("h1", {});
|
||||
|
Reference in New Issue
Block a user