Skip to content

A dish can be added to an order that has already gone - #647

Merged
sridharkalaibala merged 2 commits into
developfrom
feat/add-to-a-placed-order
Sep 13, 2026
Merged

sridharkalaibala merged 2 commits into
developfrom
feat/add-to-a-placed-order

Conversation

@sridharkalaibala

Copy link
Copy Markdown
Contributor

Owner: "if any changes like add new item to the order possible? or removing item or increase decrease quantity possible?"

Where it stood

Before Now
Increase a quantity yes yes
Decrease a quantity yes yes
Remove a line (0) yes yes
Add a new dish refused yes

A line already on the order can be scaled from its own stored prices, because every money field on it is linear in its quantity. A dish that was never on it has nothing to scale, so it was refused with not_on_this_order.

How it is priced

The loop that prices a new order's lines is now a method, _priceOnlineLine, and both callers share it. So a dish added five seconds after the order costs exactly what it would have cost in it, and meets exactly the same refusals, written once:

  • an id that is not one
  • a dish this branch does not sell
  • a dish outside its serving period ("Masala Dosa is not being served right now. It is served at Breakfast.")
  • a dish the shop has taken off the online channel

It reaches the kitchen as an add on the same changes log a waiter's amendment writes, and the order's totals move by exactly what the new line costs.

House prices, always. An order bound for a hotel room cannot be changed from a phone at all (at_the_counter), because its total carries a markup and a commission that are not the customer's to move. There is no marked-up case to reproduce here, and inventing one would be a guess about money.

Asking for none of something that was never there is a typo, not a change, and is ignored.

The assistant

change_placed_order now says a dish not on the order yet is added at the menu price, so the model stops sending a second ticket for it. The refusal guidance passes the shop's own sentence through rather than inventing one.

Tests

customer-order.service.test.js: a new dish is priced, added, logged to the kitchen as an add, and moves the total by its own cost; a dish the shop will not sell right now is refused in the shop's words and nothing is written; zero of something absent changes nothing. 10,472 API tests and 127 page tests pass, including the whole order-creation suite over the extracted method.

Owner: "if any changes like add new item to the order possible? or removing
item or increase decrease quantity possible?"

Two of the three already worked. A line already on the order could be taken
to any quantity, nought included, because every money field on it is linear
in its quantity and could be scaled from the order's own prices. A dish that
had never been on it had nothing to scale, so it was refused with
not_on_this_order and the assistant was told to send a second ticket.

Now it is priced instead, through the same method the order itself was
placed with. The loop that priced a new order's lines is a method now, and
both callers share it: the refusals are written once, so a dish added five
seconds after the order costs exactly what it would have cost in it, and is
refused for exactly the same reasons - an id that is not one, a dish this
branch does not sell, one outside its serving period, one the shop has taken
off the online channel. It reaches the kitchen as an "add" on the same
changes log a waiter's amendment writes.

House prices, always. An order bound for a hotel room cannot be changed from
a phone at all, because its total carries a markup and a commission that are
not the customer's to move, so there is no marked-up case to reproduce and
inventing one would be a guess about money.

Asking for none of something that was never there is a typo, not a change,
and is ignored rather than written.
@sridharkalaibala
sridharkalaibala merged commit 4a6c128 into develop Sep 13, 2026
10 checks passed
@github-actions github-actions Bot added the ready for QA Merged to develop and live on develop.posnic.io - anyone can test it label Sep 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Merged to develop. Anyone can test this - you do not need write access.

Try it at https://develop.posnic.io, or run it yourself:

git fetch origin develop && git checkout develop
npm install && npm --prefix api install
npm run dev   # then http://localhost:3000

When you have tested it, say what you did and what happened, and set
QA passed or QA failed. If you cannot set labels, just comment -
a maintainer will.

Reporting that something is broken is as useful as fixing it. It is
better found here than by a shopkeeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for QA Merged to develop and live on develop.posnic.io - anyone can test it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant