Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add toggle to optionally format Calculate output for automations #2468

Merged
merged 5 commits into from
Nov 23, 2023

Conversation

jessicamcinchak
Copy link
Member

@jessicamcinchak jessicamcinchak commented Nov 21, 2023

Solves what we're discussing in this thread: https://opensystemslab.slack.com/archives/C5Q59R3HB/p1700494465669089

Key changes:

  • Conditionally change the output data format depending on use for automations
  • Simplify file structure - eg Public.tsx instead of Public/index.tsx
  • Add tests

How this works:
By default, calculate writes a single value to the breadcrumbs - eg "data": { "abPath": 2 }. This is necessary to use multiple Calculate components in a row and be able to pass in number inputs (as best as I understand!).

This PR introduces an Editor-facing toggle to format the output as an array with a single string item which can then be successfully referenced to auto-answer Questions or Checklists - eg "data": { "abPath": ["2"] }.

SetValue similarly always returns an array of a single string item which is how it's able to power automations. The Pay component can successfully read a value in either format.

Test flow:
https://2468.planx.pizza/testing/a-b-testing

Copy link

github-actions bot commented Nov 21, 2023

Removed vultr server and associated DNS entries

@jessicamcinchak
Copy link
Member Author

"Group2Notice"
]
}
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a logic.test.ts isn't really an existing pattern in @planx/components/, but I think this feels like a more meaningful organisation than adding more noise to the preview store tests?

@jessicamcinchak jessicamcinchak marked this pull request as ready for review November 23, 2023 12:01
@jessicamcinchak jessicamcinchak requested a review from a team November 23, 2023 12:01
Copy link
Contributor

@Mike-Heneghan Mike-Heneghan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great 🥳

As this develops and gets more complex I'm wondering how this could be handled to differentiate between different multivariate tests and maybe even more complex stuff like nested tests.

I think it's great this has the flexibility of what the passport variable is assigned so it could maybe be managed in a similar way to current passport variables.

I'm really excited to see how this gets used and what we can learn 👀

@jessicamcinchak jessicamcinchak merged commit 960deaa into main Nov 23, 2023
13 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/calculate-automations branch November 23, 2023 20:05
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.

2 participants