Laura10101 / contractor-tax-calculator

0 stars 2 forks source link

Config app allows primary rules to be deleted that have secondary rule which depend on them #235

Closed Laura10101 closed 9 months ago

Laura10101 commented 9 months ago

Steps to reproduce

  1. Create a tiered rate rule rule
  2. Create a secondary tiered rate rule with the rule from step (1) as the primary
  3. Delete the tiered rate rule

Expected results An error should be displayed and the rule should not be deleted

Actual results The config app attempts to delete the rule, resulting in a violation of a foreign key constraint

Laura10101 commented 9 months ago

Added a validation step to check if a rule has dependents before deleting it, and to display an error if this is the case.