fix(orders): the restaurant is the merchant, not the courier
ci / lint-test (push) Successful in 43s
ci / lint-test (push) Successful in 43s
Reverses a change made on request. The platform in the headline
fragmented the merchant: the same restaurant read as two, depending on
who carried the bag, and that is not a distinction anyone rating the food
cares about. It also already has a home — the expandable Order details
panel renders expense_metadata.platform next to its heading, which is
where the user asked for it.
The fragmentation was worse than cosmetic. merchantVerdict joined on an
exact merchant_normalized, and the platforms capitalise differently
("TEG Kebabs & Biryani" on Uber Eats, "TEG KEBABS & BIRYANI" on
DoorDash), so one restaurant kept two separate histories and a "never
again" recorded through one app never warned in the other — silently
defeating the point of the memory. Now case-folded; verified on real
data, where the DoorDash order sees 1 prior verdict against 0 before.
81 existing descriptions backfilled in one transaction, dry-run first and
dumped beforehand. The regex is anchored to the end so suburb parens
survive: "Order - Coles (Wyndham Vale) (Uber Eats)" becomes
"Order - Coles (Wyndham Vale)", not "Order - Coles".
This commit is contained in:
@@ -306,17 +306,27 @@ describe("Uber trips", () => {
|
||||
});
|
||||
|
||||
describe("orderDescription", () => {
|
||||
it("names the platform", () => {
|
||||
expect(orderDescription("doordash", "Mad Mex")).toBe("Order - Mad Mex (DoorDash)");
|
||||
it("names the restaurant, not the courier", () => {
|
||||
// The platform is provenance and lives in the Order details panel, which
|
||||
// already renders expense_metadata.platform. Putting it here fragmented the
|
||||
// merchant — the same restaurant read differently depending on who carried
|
||||
// the bag, which nobody rating the food cares about.
|
||||
expect(orderDescription("doordash", "Mad Mex")).toBe("Order - Mad Mex");
|
||||
expect(orderDescription("ubereats", "Coles (Wyndham Vale)")).toBe(
|
||||
"Order - Coles (Wyndham Vale) (Uber Eats)"
|
||||
"Order - Coles (Wyndham Vale)"
|
||||
);
|
||||
});
|
||||
|
||||
it("does not restate a platform the merchant already names", () => {
|
||||
// A trip's merchant is literally "Uber Trip"; "(Uber)" after it says
|
||||
// nothing. What identifies a trip is its addresses, and those live in the
|
||||
// Order details panel.
|
||||
it("leaves a merchant that already names the platform alone", () => {
|
||||
// A trip's merchant is literally "Uber Trip". What identifies a trip is its
|
||||
// addresses, and those live in the Order details panel.
|
||||
expect(orderDescription("uber", "Uber Trip")).toBe("Order - Uber Trip");
|
||||
});
|
||||
|
||||
it("gives the same description whichever platform delivered it", () => {
|
||||
// The regression this whole change exists to prevent.
|
||||
expect(orderDescription("doordash", "TEG Kebabs & Biryani")).toBe(
|
||||
orderDescription("ubereats", "TEG Kebabs & Biryani")
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user