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

fix: update form timer to handle groups #4437

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

thiessenp-cds
Copy link
Contributor

@thiessenp-cds thiessenp-cds commented Oct 18, 2024

Summary | Résumé

Improves the form timer by handling the case of forms with groups. If a form has groups, the delay calculation includes required questions based on the group history. The time a user spends on a form is now also included in the calculation.
This is a high risk PR since it updates forms-forms submission logic.

Test

The form timer should not display in the form-builder Preview. The form timer is only for forms-forms

Groups Form

Create a form with groups and add a few required questions. View the form you created and open the dev console. Reload the form (to restart the timer) and quickly fill in the form, counting the number of required questions. When you get to the Review page, check the console and see if the final delay makes sense.

For example, a form that has 10 required questions and has been view for 5 seconds, should have a delay of
2 + (10 - 5) * 2 = 12 seconds

Note that the countdown begins once the Review page loads. So if you linger on the Review page for e.g. 5 seconds and then click the submit button, count down delay should start at e.g. 7 seconds (with a total delay listed of 12 seconds)

Non-Groups Form

Create a form without groups and add a few required questions. Following the same steps above. The difference is the time a form is viewed is not taken into account (existing behaviour - countdown begins when the single page form is shown).

Copy link
Contributor

@thiessenp-cds thiessenp-cds changed the title fix: improve form timer (2) fix: improve form timer Oct 21, 2024
@thiessenp-cds thiessenp-cds changed the title fix: improve form timer fix: update form timer to handle groups Oct 21, 2024
@thiessenp-cds thiessenp-cds marked this pull request as ready for review October 21, 2024 19:00
* @param form the current form
* @param currentGroupId group Id of the current page
*/
addRequiredQuestions: (form: FormProperties, currentGroupId: string) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rename to "updateFormDelay" and mention setting the time in the comments

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