Skip to content

Fix copied form not added to group if it has no questions#2605

Merged
stephencdaly merged 1 commit intomainfrom
fix-copied-form-not-added-to-group
Mar 10, 2026
Merged

Fix copied form not added to group if it has no questions#2605
stephencdaly merged 1 commit intomainfrom
fix-copied-form-not-added-to-group

Conversation

@stephencdaly
Copy link
Contributor

What problem does this pull request solve?

When copying a draft form with no questions, it was not being added to a group. This was because we were trying to create the GroupForm before the copied form had been saved. If the form has no associated questions, it would not have been assigned an ID yet, and the GroupForm creation would silently fail.

Assign the form to the group after it has been saved to fix this.

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Do the end to end tests need updating before these changes will pass?
  • Has all relevant documentation been updated?

When copying a draft form with no questions, it was not being added to
a group. This was because we were trying to create the GroupForm
before the copied form had been saved. If the form has no associated
questions, it would not have been assigned an ID yet, and the
GroupForm creation would silently fail.

Assign the form to the group after it has been saved to fix this.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2605.admin.review.forms.service.gov.uk/

It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

@stephencdaly stephencdaly added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main with commit a2b05f8 Mar 10, 2026
7 checks passed
@stephencdaly stephencdaly deleted the fix-copied-form-not-added-to-group branch March 10, 2026 10:18
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