rubyforgood / rubyforgood/human-essentials
Clean up old data -- Duplicate items in a Request
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 593
- Forks
- 593
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 41
Description
Summary
Clean up old data to validate against the item_requests_uniqueness_by_item_id Request validation.
Why?
So that if these records ever need to be modified they can be.
A user has an old request that they cannot discard because it fails the unique-item validation.
Details
For any Request with duplicate items, merge them together and sum the quantity. Put this into a database migration.
Other things to know/consider
- You'll have to fake this scenario in your dev database to test!
- Core team only so we can also validate against a production DB snapshot
Criteria for completion
- No Requests have duplicate items after the DB migration is run
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Request model and its item_requests_uniqueness_by_item_id validation, then create duplicate items in a development database to reproduce the scenario. Implement the requested database migration to merge duplicates and sum quantities, and verify that no Requests have duplicate items after it runs; production DB snapshot validation is also required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100