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

@@ -659,6 +659,38 @@ class TenantController extends GetxController {
///
/// **If tenant 13 is not the milk-run client**, this line is the whole fix:
/// remove the 13 and a rider on it goes back to logistics.
/// ══ THE APP IS PINNED TO THE MILK MAN LINE ══
///
/// **This is a temporary operating decision, not a permanent one.** While it
/// is `true`, [resolveServiceProfile] returns [ServiceProfile.milkMan] before
/// it consults the rider's tenant, the token claim or the build flag — so
/// every signed-in rider works the milk round and the logistics
/// customer-pickup flow is unreachable from the UI.
///
/// ── Why it is a pin and not a deletion ──
///
/// The logistics screens are not removed, and nothing about them is edited.
/// The whole line is gated behind [ServiceProfile.handsOffAtCollection] and
/// its siblings already, so pinning the profile is enough to take it off the
/// screen — and turning it back on is this one word. Deleting the code would
/// have been a one-way door for a decision described as "as of now".
///
/// ── What it fixes today ──
///
/// Tenant resolution is name-first, and the milk-run rider's tenant is
/// spelled `Doormile` — which [logisticsTenantNames] maps, correctly and
/// deliberately, to **logistics**. So a genuine milk-man rider resolved to
/// the parcel line, and every symptom followed from that one answer: accept
/// handed off immediately and jumped him to the work tab, the Bookings page
/// offered **Start Pickup** for orders that belong on Home, and the leg the
/// distance measured to was the kitchen rather than the door.
///
/// ── Turning it off ──
///
/// Set to `false` and the app resolves per rider again, exactly as before.
/// Do that before shipping any build a logistics rider will sign in to.
static const bool pinToMilkManLine = true;
static const Set<int> milkManTenantIds = <int>{13};
/// The old name for [milkManTenantIds].
@@ -800,7 +832,19 @@ class TenantController extends GetxController {
/// seeing a payment prompt he can dismiss; the other direction takes the
/// cash-collection screen away from a live logistics rider at a door.
Future<ServiceProfile> load() async {
final resolved = await resolveServiceProfile();
// ── The pin sits here, not inside the resolver ──
//
// `resolveServiceProfile()` is a pure function over the rider's account and
// it is what the tenant tests exercise directly; short-circuiting *it* made
// 24 of them assert against a function that no longer answered the question
// they were asking. This method is the app's only caller and the single
// place the answer is published, so pinning here takes the whole app onto
// the milk round while leaving the resolution rules intact and testable.
//
// See [pinToMilkManLine] for what this is for and how to lift it.
final resolved = pinToMilkManLine
? ServiceProfile.milkMan
: await resolveServiceProfile();
ServiceProfile.setActive(resolved);
profile.value = resolved;
debugPrint('[TENANT] resolved ${resolved.label}');