Skip to content

Commit

Permalink
- delete downloaded species of a survey
Browse files Browse the repository at this point in the history
  • Loading branch information
temi committed Feb 9, 2024
1 parent 5b33629 commit 3da10a1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions grails-app/assets/javascripts/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,25 @@ var entities = (function () {
return $.when.apply($, promises);
}

function deleteSpeciesForProjectActivity(pa) {
var promises = [];
pa.speciesFields && pa.speciesFields.forEach(function (field) {
var config = field.config, type = config.type;
console.log("fetching species");
switch (type) {
case GROUP:
case SINGLE:
promises.push(deleteSpeciesEntries(pa.projectActivityId, field.dataFieldName, field.output));
break;
case ALL:
promises.push(deleteAllSpecies());
break;
}
});

return $.when.apply($, promises);
}

function onlineGetSpeciesForProjectActivityAndFieldInOutput(offset, projectActivityId, dataFieldName, outputName, limit) {
return $.ajax({
url: fcConfig.fetchSpeciesUrl, data: {
Expand Down Expand Up @@ -833,6 +852,7 @@ var entities = (function () {
countAllSpecies: countAllSpecies,
offlineGetDocument: offlineGetDocument,
getProjectActivityMetadata: getProjectActivityMetadata,
deleteSpeciesForProjectActivity: deleteSpeciesForProjectActivity,
getSpeciesForProjectActivity: getSpeciesForProjectActivity,
bulkDeleteDocuments: bulkDeleteDocuments,
deleteSites: deleteSites,
Expand Down

0 comments on commit 3da10a1

Please sign in to comment.