mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Enhance bulk booking handling and wagon capacity calculations across services
This commit is contained in:
@@ -400,8 +400,18 @@ export class BookingPricingService {
|
||||
* All three components are produced by RuleEngineService.evaluate, so submit
|
||||
* simply re-runs the engine — there is no extra submit-time inflation.
|
||||
*/
|
||||
async computeSubmitPriorityScore(booking: Booking): Promise<number> {
|
||||
async computeSubmitPriorityScore(
|
||||
booking: Booking,
|
||||
totalWagonsOverride?: number,
|
||||
): Promise<number> {
|
||||
const evalInput = await this.buildEvalInputForBooking(booking);
|
||||
// BULK bookings have no container lines, so buildEvalInputForBooking yields
|
||||
// totalWagons = 0 and every wagon-range priority config misses. The batch
|
||||
// engine derives a bulk booking's wagon footprint from tonnage vs. live
|
||||
// wagon capacity and passes it here to score the booking properly.
|
||||
if (totalWagonsOverride != null && totalWagonsOverride > 0) {
|
||||
evalInput.totalWagons = totalWagonsOverride;
|
||||
}
|
||||
const ruleResult = await this.ruleEngineService.evaluate(evalInput);
|
||||
return ruleResult.priorityScore;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user