A table call that arrived by sync rings until somebody answers - #867
Merged
Merged
Conversation
A counter-made call rings until answered: the API's insert path raises 'waiting' with the call's id and the dock's "seen" resolves that id. A call that arrived by sync never took that path, and the agent's pull line says how many rows landed, not which. Since #859 it rang the arrival bell once and sat in the dock. Now the till asks. After a pull into waitercalls, the main process reads the open calls from its own API - GET /sales/waiterCalls/open, kiosk-keyed and registered before the session guard because this process has no session - and raises the same 'waiting' per call_id the counter would have. "Seen" at the dock resolves it exactly as before. A call answered somewhere else leaves the list on the next pull and is resolved here, so nothing rings for a table that has been served. A second pull of the same open call does not start a second alarm. If the read fails, the arrival bell sounds once and the dock still shows the call: a shop must hear something, and must never hear an alarm it cannot stop. openWaiterCalls with no branch now means every branch this installation serves; `{ branch_id: undefined }` matched nothing. The row says its branch, so a device serving one branch can ignore another's. The docs and the README badge follow the new route: 660 endpoints.
Contributor
|
Merged to 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:3000When you have tested it, say what you did and what happened, and set Reporting that something is broken is as useful as fixing it. It is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The step #859 named as next. A counter-made call rings until answered because the insert path raises
waitingwith the call's id and the dock's "seen" resolves that id. A call that arrived by sync never took that path, and the agent's pull line carries a count, not ids; since #859 it rang the arrival bell once and sat in the dock.Now the till asks:
apirouteGET /sales/waiterCalls/openoptionalProtect, protectOrKioskKey, like the floor screen), registered beforerouter.use(protect)because the main process has no sessionapicontroller / serviceapirepositoryopenWaiterCalls{ branch_id: undefined }matched nothing); each row says itsbranch_idso a device serving one branch can ignore another'ssrc/sync-agent-manager.jswaitercalls, read the open calls and raisewaitingpercall_id; a call already ringing is not started twice; a call that left the list (seen elsewhere, synced down) is resolved here; if the read fails, the single arrival bell as before"Seen" at the dock resolves the alarm exactly as it does for a counter-made call. A shop must hear something, and must never hear an alarm it cannot stop; both are tested.
Tests
tests/a-cloud-order-reaches-the-kitchen-at-once.test.js14/14: ringswaitingper id with the branch; the same open call on the next pull does not ring twice; a call answered elsewhere is resolved on the next pull; a failed read falls back to onereceivedbell; the route sits before the session guard and the till sends its key to that exact path.tests/unit/routes/sales.routes.test.js4/4: the route is registered beforeprotectand carriesprotectOrKioskKey.On hardware
Ordering page at a table, tap "call waiter": the till rings and keeps ringing until the dock's "seen"; seen on the cloud dashboard instead, the till stops on its next pull.