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

Add missing kit rspecs, DRY up kit base items and report service #4665

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

jimmyli97
Copy link
Contributor

@jimmyli97 jimmyli97 commented Sep 24, 2024

Split off from PR #4585
Various refactors and documentation changes

Description

  • Rename item.kits scope to item.housing_a_kit
  • DRYs up kit base_item seeding
  • Removes duplicated code and rspec from ChildrenReportService
  • Add rspecs to:
    • prevent kit base_item deletion
    • test item.is_in_kit?, item.loose, item.housing_a_kit
  • Add documentation

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

How Has This Been Tested?

passes test suite

* Clearer name
* Add rspecs to test :housing_a_kit and :loose scopes
… deletion

* Move seed_base_items code into one static function
* Move kit base item creation code into one static function
* Add code to prevent calling destroy on kit base item and corresponding rspec
* Added comments - not sure about whether other base item request specs are useful or what the purpose of destroy is in the controller if it can't be called
* All SQL code is duplicated in AcquisitionReportService
* RSpec is close enough to what is in AcquisitionReportService Spec that it can be removed without merging in
  (only difference is Diapers - Adult Briefs category is not created, but that shouldn't matter
  because the SQL looks for %diaper% so this category isn't testing anything different)
* Rename to snake case
* Add docs noting base items will be changed
@@ -31,47 +31,8 @@ def average_children_monthly
total_children_served / 12.0
end

def disposable_diapers_from_kits_total
organization_id = @organization.id
Copy link
Contributor Author

@jimmyli97 jimmyli97 Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(continuing conversation from #4585)

these lines were removed because they're unused in this service and duplicated in AcquisitionReportService (probably the author copied AcquisitionReportService as a template when creating this service and forgot to delete them)

@cielf cielf requested a review from dorner September 24, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant