Skip to content

Commit

Permalink
Script to update report affected by AtlasOfLivingAustralia/ecodata-cl…
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Jan 27, 2025
1 parent 32771a5 commit aa039ae
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/scripts/releases/4.2/adhoc/markOutputsAsNotApplicable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
load('../../../utils/audit.js');
let reportId = 'ac5c0470-c654-40e1-9535-bfaf620fe883';
let adminUserId = 'system';

let outputsToMarkAsNotApplicable = ['NHT - Identifying sites', 'NHT - Weed treatment', 'NHT - Baseline data'];

let report = db.report.findOne({reportId:reportId});
let activityId = report.activityId;

printjson(db.output.find({activityId:activityId, name:{$in:outputsToMarkAsNotApplicable}}, {outputId:true, name:true, outputNotCompleted:true}));

for (let i=0; i<outputsToMarkAsNotApplicable.length; i++) {
let output = db.output.findOne({activityId:activityId, name:outputsToMarkAsNotApplicable[i]});
if (output.outputNotCompleted === false) {
output.outputNotCompleted = true;

db.output.replaceOne({outputId:output.outputId}, output);
audit(output, output.outputId, 'au.org.ala.ecodata.Output', report.projectId);
}
}

0 comments on commit aa039ae

Please sign in to comment.