Repository navigation
Give the Total field a formula editor - #17
Merged
Merged
Conversation
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
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.
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
{id}reference at the caret (labelled by the question, not the id),name()with the caret parked inside the parentheses,calculate()engine the front end runs, so a formula that computes here computes there,Verified live on 8889 against the user's own repro form (Alignment Check's Total): chips insert,
{f3} + {f4} * 10previews as21with 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