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 error with return cycles seeder #1399

Merged
merged 2 commits into from
Oct 10, 2024
Merged

Conversation

Cruikshanks
Copy link
Member

https://eaflood.atlassian.net/browse/WATER-4543

In Create return cycle we added a new seeder for return cycles.

They are part reference and part transactional records. When starting with a clean environment, you would need to seed existing return cycles. Going forward, they are automatically created as part of creating return logs. When we create the first return log for a cycle, if the cycle record does not exist, we make it.

When we added the seeder, though, the query we wrote was purely an insert. It should have been an upsert because seeders need to be written so they can be run multiple times against the same environment (both test and 'real').

This fixes the query used to actually be an upsert.

https://eaflood.atlassian.net/browse/WATER-4543

In [Create return cycle](#1353) we added a new seeder for return cycles.

They are part reference, part transactional records. When starting with a clean environment you would need to seed existing return cycles. Going forward, they are automatically created as part of creating returns logs. When we come to creating the first return log for a cycle, if the cycle record does not exist then we create it.

When we added the seeder though, the query we wrote was purely an insert. It should have been an `upsert` because seeders need to be written in such a way they can be run multiple times against the same environment (both test and 'real').

This fixes the query used to actually be an upsert.
@Cruikshanks Cruikshanks added the bug Something isn't working label Oct 10, 2024
@Cruikshanks Cruikshanks self-assigned this Oct 10, 2024
@Cruikshanks Cruikshanks marked this pull request as ready for review October 10, 2024 10:53
@Cruikshanks Cruikshanks merged commit 06c15dd into main Oct 10, 2024
4 checks passed
@Cruikshanks Cruikshanks deleted the fix-return-cycle-seeding branch October 10, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants