miler map

This commit is contained in:
2026-09-09 12:55:23 +05:30
parent 074cc0eccf
commit 127fa062ed
143 changed files with 4315 additions and 2291 deletions

View File

@@ -254,14 +254,34 @@ void main() {
);
});
test('collected ends the job on a line that ends at the hub', () {
// Terminal here, unlike on the milk run: the parcel becomes a consignment
// and the hub carries it from there.
expect(WorkBoundary.isClosed(order('P1', status: 'picked')), isTrue);
test('collected no longer ends the job by line default', () {
// ── This assertion used to be the opposite, and it was the bug ──
//
// `isClosed` read `isPicked && ServiceProfile.active.endsAtHub`, which is
// always true on logistics, so **every** collected parcel was written off
// at the pickup — including a hyperlocal one the pivot had just released
// into this rider's own hands. He left the sender's door carrying a
// parcel his app had already filed as finished.
//
// Where a collected parcel goes next is the backend's decision, per
// order, and this row carries no answer yet: no consignment state and no
// recorded pivot instruction. So it resolves to [NextLeg.unknown], which
// keeps custody rather than guessing — the parcel is in his hands, and
// the honest screen is the work tab, not Activity. See [NextLegResolver].
expect(WorkBoundary.isClosed(order('P1', status: 'picked')), isFalse);
expect(
WorkBoundary.domainOf(order('P1', status: 'picked')),
WorkDomain.closed,
WorkDomain.delivery,
);
});
test('the backend closing it is what closes it', () {
// `Inwarded_at_Hub` is the hub taking the parcel into its own custody.
// That is a real ending, and it comes from the server.
final handed = order('P1', status: 'picked')
..['consignmentstatus'] = 'Inwarded_at_Hub';
expect(WorkBoundary.isClosed(handed), isTrue);
expect(WorkBoundary.domainOf(handed), WorkDomain.closed);
});
});
}