openspp-modules icon indicating copy to clipboard operation
openspp-modules copied to clipboard

added validation for deleting membership in individual

Open reichie020212 opened this issue 1 year ago • 2 comments

Why is this change needed?

Individual is able to remove membership even if the individual is the head of a farm

How was the change implemented?

Added a validation

New unit tests

None

Unit tests executed by the author

None

How to test manually

  • Install farmer registry demo module
  • Go to Registry -> Farm and create a farm
  • Go to Individual and enter the individual record
  • Go to Groups tab
  • Make sure that the individual is the head of the farmer
  • Delete the record in the groups tab then save.
  • Check if there is an error.

Related links

https://github.com/OpenSPP/openspp-modules/issues/583

reichie020212 avatar Oct 04 '24 05:10 reichie020212

Codecov Report

Attention: Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.

Project coverage is 73.22%. Comparing base (c2d1b67) to head (ab91df9). Report is 190 commits behind head on 17.0.

Files with missing lines Patch % Lines
...pp_farmer_registry_base/models/group_membership.py 45.45% 6 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             17.0     #620      +/-   ##
==========================================
- Coverage   73.50%   73.22%   -0.29%     
==========================================
  Files         560      545      -15     
  Lines       14084    13631     -453     
  Branches     1799     1751      -48     
==========================================
- Hits        10353     9981     -372     
+ Misses       3414     3352      -62     
+ Partials      317      298      -19     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 04 '24 05:10 codecov[bot]

Verified and working as expected.

Test Steps:

  1. Install farmer registry demo module
  2. Go to Registry -> Farm and create a farm
  3. Go to Individual and enter the individual record
  4. Go to Groups tab
  5. Make sure that the individual is the head of the farmer
  6. Delete the record in the groups tab then save.
  7. Check if there is an error.
  • Group tab and then delete group vie the delete icon: image

  • After group deletion: image

  • Error message when trying to exit the individuals tab without a HH head: image

anjclarise avatar Oct 27 '24 09:10 anjclarise