Skip to content

Give the Total field a formula editor - #17

Merged
AllTerrainDeveloper merged 1 commit into
mainfrom
feature/formula-editor
Aug 19, 2026
Merged

AllTerrainDeveloper merged 1 commit into
mainfrom
feature/formula-editor

Conversation

@AllTerrainDeveloper

Copy link
Copy Markdown
Owner

Daniel's report: "the total control does not offer to open the formula editor" — because none existed; the formula was a bare text input plus a hint listing function names.

Now: a Formula editor button beside the box opens a modal where

  • every number-shaped question on the form is a chip that inserts its {id} reference at the caret (labelled by the question, not the id),
  • every engine function is a chip inserting name() with the caret parked inside the parentheses,
  • the result computes live against sample answers on every keystroke — through the shared calculate() engine the front end runs, so a formula that computes here computes there,
  • a non-parsing formula says so in words; Save writes back trimmed.

Verified live on 8889 against the user's own repro form (Alignment Check's Total): chips insert, {f3} + {f4} * 10 previews as 21 with the sample substitution spelled out.

6 new vitest (targets/samples/insert/preview/error/save), 261 total ✓; 603 PHPUnit ✓; PHPCS 0 errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp

The formula was a bare text box and a hint listing function names — which
assumes the person writing it already knows their fields' ids and the
engine's grammar, the two things nobody knows. The editor turns both into
buttons: every number-shaped question on the form is a chip that inserts
its reference, every engine function is a chip that inserts itself with
the caret left inside the parentheses, and the result computes live
against sample answers as you type — through the same shared engine the
front end runs, so a formula that computes here computes there. A
formula that does not parse says so in words instead of showing nothing.

The bare box stays beside the button, for somebody pasting a formula in.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp
@AllTerrainDeveloper
AllTerrainDeveloper merged commit 6f2dc9b into main Aug 19, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant