Land Agreements - how to delete tract interests to upload new ones
🤔 Problem
Currently, our system doesn't update interests when a tract template is uploaded with existing tracts that already have interests. Instead of replacing the old interests with the new ones, it adds them together, which results in an error — Take the screenshot below for example, a few tracts in the template already existed in the system and it threw an error saying the interests cannot exceed a sum of 1.0.

🌱 Solution
Until this is fixed on this ticket https://wenergysoftware.atlassian.net/browse/WEMAIN-18593#icft=WEMAIN-18593 we rely on removing the interests via script so that we or the client can upload the tract template.
First, you’ll need to get every tract number that is in the `Interests` tab in the template and remove all the duplicates.
Then you’ll need to add the unique tract #'s in the script below and run it
DELETE FROM royalty_ratesWHERE tract_id IN (SELECT idFROM tractsWHERE NUMBER IN ('paste your tract #'s here')Once the script is run you can try and upload the tract template again and it should upload without any errors.
Highlight important information in a panel like this one. To edit this panel's color or style, select one of the options in the menu.