mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 00:50:56 +00:00
booking operations and trains scheduling also allocations
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type { BookingListRow } from "@/types/booking";
|
||||
import { compareSchedulingPriority } from "./compareSchedulingPriority";
|
||||
import {
|
||||
groupBookingsByThreeHourWindow,
|
||||
type ThreeHourBookingBucket,
|
||||
} from "./groupBookingsByThreeHourWindow";
|
||||
|
||||
export interface OperationsQueueGroups {
|
||||
government: BookingListRow[];
|
||||
commercial: ThreeHourBookingBucket[];
|
||||
}
|
||||
|
||||
export function groupBookingsForOperationsQueue(
|
||||
bookings: BookingListRow[],
|
||||
): OperationsQueueGroups {
|
||||
const government = bookings
|
||||
.filter((b) => b.isGovernment)
|
||||
.sort(compareSchedulingPriority);
|
||||
const commercial = groupBookingsByThreeHourWindow(
|
||||
bookings.filter((b) => !b.isGovernment),
|
||||
);
|
||||
return { government, commercial };
|
||||
}
|
||||
Reference in New Issue
Block a user