SEED-platform / seed

Standard Energy Efficiency Data (SEED) Platform™ is a web-based application that helps organizations easily manage data on the energy performance of large groups of buildings.
Other
107 stars 55 forks source link

AH - Deleting ALI errors when users, properties, or property states still exist #4491

Closed kflemin closed 8 months ago

kflemin commented 8 months ago

Properties and property states are created during the import process and are not necessarily cleaned up by deleting a property from the inventory list page. There could be lingering properties or property states that are associated with a particular ALI, but that are not associated with a property view, and are therefore invisible to the user.

Use cases that can cause this issue are: 1) bailing halfway through the import process and 2) the match-merge-link process.

When this happens, even though there are no properties visible to the user that are associated with an ALI, the ALI cannot be deleted. The same situation occurs when there are users attached to the ALI.

Example error that gets returned to the user: Cannot delete this access level instance. - Has 10 related Property States

  1. We need a method to move users to another ALI (in a separate ticket)
  2. We need to add an "are you sure you want to delete this ALI? this will delete all properties and property states associated with the ALI". If the user says yes, then clean up those properties and property states (or clear out their ALIs?) so that the ALI can be deleted.

Otherwise, the only recovery from this is for an admin to "Remove Inventory" on the whole org.

haneslinger commented 8 months ago

I think https://github.com/SEED-platform/seed/pull/4492 fixes it?

RDmitchell commented 8 months ago

Instance: dev2 SHA: a79e79785 Org: LBNL 406

Clicked on the Delete icon for Level 3, AH County / Alameda and this message appeared, which is correct. image\

I then clicked the Delete button, and that level, with all it's properties, was deleted, which is also correct.