mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
24 lines
729 B
TypeScript
24 lines
729 B
TypeScript
import type { BookingListRow } from "@/types/booking";
|
|
import { compareSchedulingPriority } from "./compareSchedulingPriority";
|
|
import {
|
|
groupBookingsByThreeHourWindow,
|
|
type ThreeHourBookingBucket,
|
|
} from "./groupBookingsByThreeHourWindow";
|
|
|
|
export interface OperationsQueueGroups {
|
|
government: BookingListRow[];
|
|
commercial: ThreeHourBookingBucket<BookingListRow>[];
|
|
}
|
|
|
|
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 };
|
|
}
|