rubyforgood / rubyforgood/human-essentials

Clean up old data -- Duplicate items in a Request

Open
#5,276 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core team
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.

https://app.bugsnag.com/ruby-for-good/human-essentials/errors/6802b26bba22dd56911d0b81?filters[error.status]=open&filters[event.since]=30d

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.