human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

WIP [Phase 1 Kit Refactor] Fix #3707 add itemizable item, migrate kit line items (backup db before merge)

Open jimmyli97 opened this issue 1 year ago • 4 comments

Resolves #3707 Merges and closes #3750

Description

Merge #4585 and #4665 first BACKUP database before merging - includes migration in e866880 which changes kit line items to point to the item housing the kit as their Itemizable.

From original issue #3707:

  • Adds itemizable module to base Item class
  • Adds migration to change kit line items to point to the item housing the kit
  • Update rspecs, views, KitCreateService, Allocation and Deallocation to point to the item housing the kit instead of the kit
  • Move validations from kit to Item

Additional things done:

  • Add validation to Item which ensures items which don't house kits don't have line items
  • Disabled Itemizable specs for Item temporarily (it will be easier to do these when working on phase 2)
  • Rename previous association Item.line_items to Item.contained_in_line_items to avoid name conflict
  • Add testing a kit to storage_location total_value spec
  • Add testing multiple line items when creating kit to kit system spec

Type of change

  • Breaking change

How Has This Been Tested?

  • passes test suite
  • manual testing:
    • kits show up correctly Kits index
    • kit item shows up in Item index
    • kit creation, allocation, deallocation work
    • kit and kit item can be deactivated and reactivated (noticed a bug present on main branch where on reactivating kit item the corresponding kit doesn't get reactivated, but this should be fixed by phase 2 refactor)
    • kits affect inventory items correctly on Adjustment, Audit, Transfer
    • kits appear on Donations, Purchases, Distributions, Requests, Reports

jimmyli97 avatar Aug 01 '24 00:08 jimmyli97

failing test is a flake, added to list

jimmyli97 avatar Aug 29 '24 00:08 jimmyli97

both failed tests are flakes

jimmyli97 avatar Aug 29 '24 01:08 jimmyli97

Hey @jimmyli97 -- just to manage expectations. @dorner is our lead on the kit rework, so we'll want to make sure he has a final review on this. He's more than usually busy at work this/next week, so it may take some time to get it through.

cielf avatar Aug 30 '24 13:08 cielf

@cielf no worries I understand. The roadmap he wrote was pretty clear, I can probably keep working on phase 2 and database cleanup when I get a chance

jimmyli97 avatar Aug 30 '24 14:08 jimmyli97

@jimmyli97 thank you very much for this work, but unfortunately we've changed too many related things and let this PR age a bit too much for us to be able to merge it. So I'm closing it (and another similar PR), though we'll have the code for inspiration if/when reforming kits comes back around as a priority. Thank you again!

awwaiid avatar Jun 22 '25 14:06 awwaiid