-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script to update report affected by AtlasOfLivingAustralia/ecodata-cl…
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/main/scripts/releases/4.2/adhoc/markOutputsAsNotApplicable.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |