fpdcc / ccfp-asset-dashboard

CCFP Asset Dashboard
0 stars 1 forks source link

Prevent assets from being duplicated #266

Closed smcalilly closed 1 year ago

smcalilly commented 1 year ago

Bug description

When selecting assets with the map draw tool, a user can re-select an asset that they've already selected. This duplicates the asset so that the asset shows up one or more times for a phase.

Exposed in #252.

Fix

If a user has already selected an asset, then some logic should prevent the same asset from being submitted to the API. This should happen in the javascript code that prepares the assets to be submitted to the API. The SelectAssetsMap.js component submits the data to the API, and the GeometrySelector component parses out the assets from the selected region. You'll need to add some helper code to the GeometrySelector that compares the selected assets with the phase's existing assets, and only include the selected asset in the payload that's submitted to the API.

Completed

This issue will be completed when a user can select and save the same asset in the map multiple times without duplicating the asset in the database.