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 6 months 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