Set the session order¶
A design for a feature that is not built yet. A Loved One picks which memories Tom sees and in what order, on the family web app, and his phone plays exactly that list the next time he taps Start.
Why¶
The first test with Tom runs T1, T2, and T5 from the session log. Each row of the log is planned before the session: which memory, which test case. Today the phone picks the memories itself, so the person watching cannot plan rows ahead, and two sessions are never the same.
With a set order, the session log can be filled in before Tom starts: rows 1 to 5 are the planned memories, in order, each with its test case. During the session the observer only writes what happened.
How the app picks memories today¶
planSession in apps/mobile/src/features/memories/history.ts decides the
order once, when Start is tapped:
- New memories, and ones whose picture changed, in random order.
- Memories never seen, in random order.
- Memories seen longest ago.
It takes the first five. The very first session on a phone is a plain random
draw. The phone keeps the seen-history to itself (memories-history-v1:<senior
id> in AsyncStorage) and never sends it anywhere.
What changes¶
For the Loved One (web app)¶
The Memory screens page gets a Next session panel above the cards:
- Five numbered slots. Each slot is a dropdown of the senior's memories that have a picture: the app's memories and the photo memories Loved Ones added. Each choice shows the picture type, so "Photo", "Illustration", or "Video" is visible while planning T2.
- Move up, Move down, and Remove buttons on each slot. There is no drag-only reordering (WCAG 2.2, 2.5.7 Dragging Movements).
- Each memory card gets an Add to next session button that fills the next empty slot.
- Save order and Use the app's choice (clears the order).
- A status line: "Tom's phone plays these 4 memories in this order. Saved October 12 by Thomas." With no order: "Tom's phone picks the memories."
Fewer than five slots is fine. A session of three planned memories ends with Exit on the third.
For Tom (phone)¶
Nothing on screen changes. He taps Start and sees the planned memories in order, then Exit on the last one, as today.
How long an order lasts¶
An order stays until a Loved One clears it. Every session plays the same list. That keeps the test repeatable, and the phone never has to write back to say an order was used.
The risk is forgetting to clear it, so Tom sees the same memories for days. The status line on the web is the reminder. A "next session only" choice is an open question below.
Rules on the phone¶
- If an order is set, the phone plays its memories in that order instead of calling the usual rules.
- A memory in the order that the phone cannot show (deleted, its picture removed, or no picture at all) is skipped. If none can be shown, the phone falls back to the usual rules, so Tom never sees an empty session.
- Each memory shown still goes into the seen-history. After the order is cleared, the usual rules resume, and the planned memories come last because they were seen most recently.
- The Memory Detail is still drawn at random when a memory has several.
When the phone picks it up¶
The phone reads the order when it reads a new photo or song: when Memories opens, when the app comes back from the background, and on Back to start. Offline, the phone uses the last order it read.
How to build it¶
It follows the pattern of memory songs (memory_songs), the most recent
per-bank setting.
Worker (apps/api)¶
- Migration
0009_memory_session_orders.sql:
CREATE TABLE memory_session_orders (
bank_id TEXT PRIMARY KEY REFERENCES memory_banks(id),
memory_ids TEXT NOT NULL, -- JSON array, 1 to 5 ids, in order
updated_by TEXT NOT NULL REFERENCES users(id),
updated_at TEXT NOT NULL
);
src/routes/memory-session-order.ts, mounted at/banks/:bankId/memory-session-order:GET /(any access) returns{ sessionOrder: { memoryIds, updatedBy, updatedAt } | null }.PUT /(manage) takes{ memoryIds: string[] }: 1 to 5 ids, no repeats, each passingisMemoryId. Anything else is a 422.DELETE /(manage) clears it.- The Worker cannot check that an id is a real memory, since the app's memories are bundled in the phone. The web only offers real ones, and the phone skips unknown ones.
Shared (packages/shared)¶
ApiSessionOrderandSessionOrderResponseinapi-types.ts.MEMORIES_PER_SESSION = 5moves here fromapps/mobile/src/features/memories/memories.ts, so the Worker, the web, and the phone agree on the limit.
Phone (apps/mobile)¶
src/features/bank/session-order.ts:fetchSessionOrder, a parser, and a cache underbank-memory-session-order-v1:<senior id>. A fetch that succeeds with no order clears the cache; a failed fetch keeps it.useSessionOrder()returns the order ornull. A separate hook keepsuseStoryPool's return type unchanged for its other callers.planSession(memories, history, random, order?): whenorderresolves to at least one showable memory, return those in order (up to five, details drawn as today); otherwise run the usual rules. It stays a pure function.ConnectedMemoriesScreenwaits for the order to load, as it already waits for the history, then passes it through.
Web (apps/web)¶
api.ts:getSessionOrder,putSessionOrder,clearSessionOrder.src/session-order-panel.tsx, rendered at the top ofMemoryScreensSection, plus the Add to next session button onMemoryCard.
Tests¶
apps/mobile/tests/memory-history.test.ts: an order wins, unknown ids are skipped, an all-unknown order falls back, more than five are cut to five.apps/api/tests/routes/memory-session-order.test.ts: access rules (view vs. manage), validation, put then get, delete.- A web test that the panel saves, reorders with buttons, and clears.
Docs to update when it ships¶
docs/dev/memories.md: its "the draw is random" line is already out of date; describe the usual rules and the set order.docs/dev/memory-screens.md: the Next session panel.docs/session-log.md: setting the order becomes a step in "Before the session".- Move this page out of Prototypes.
A first order to try¶
A suggestion for the first visit (T1, T2, T5). T1 is the whole session, so every row also serves T1.
| Slot | Memory id | Picture | Test case |
|---|---|---|---|
| 1 | stories-wedding-day |
Photo | T2 |
| 2 | stories-e-train |
Illustration | T2 |
| 3 | stories-skydiving |
Video | T2 |
| 4 | stories-smoke-school |
Illustration | T2, a second illustration |
| 5 | the golf memory, when it is in | Photo | T5. Until it exists, stories-dodge-dart (photo, T2) instead. |
Open questions¶
- Next session only? A choice to use the order once, then go back to the usual rules, would suit the two weeks at home (T8). It needs the phone to tell the Worker the order was used.
- Set the song and the Memory Detail per slot? T4 (song on vs. off) and T3 (question vs. statement) need those fixed too. That could be a second step: each slot gets "Song: on or off" and "Detail: pick one".
- Show the order on the start screen? Probably not for Tom. A small "Planned session" note might help the person running the test confirm the phone has it.