Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- CR commit
  • Loading branch information
temi committed Oct 10, 2024
1 parent e576787 commit 1be5d7f
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
load('../../utils/audit.js');
var programId = "834f6ec8-100b-44c2-9527-72d12d6edd89", projects = [], reports = [], activities = [],
reportName= "Progress Report 1", activities = [], newFormVersion = NumberInt(1), counter = 0;
reportName= "Progress Report 1", activities = [], newFormVersion = NumberInt(1), counter = 0,
user="system";

db.project.find({programId: programId}).forEach(function(program) {
projects.push(program.projectId);
db.project.find({programId: programId}).forEach(function(project) {
projects.push(project.projectId);
});
print("Projects: " + projects.length);
db.report.find({projectId: {$in: projects}, name: reportName }).forEach(function(report) {
Expand All @@ -13,7 +15,9 @@ db.report.find({projectId: {$in: projects}, name: reportName }).forEach(function
print("Reports length " + reports.length + " reports list " + reports);
db.activity.find({activityId: {$in: activities}, progress: "planned"}).forEach(function(activity) {
if (!activity.formVersion) {
activity.formVersion = newFormVersion;
db.activity.updateOne({activityId: activity.activityId}, {$set: {formVersion: newFormVersion}});
audit(activity, activity.activityId, 'au.org.ala.ecodata.Activity', user);
print("Activity " + activity.activityId + " updated.");
counter++;
}
Expand Down

0 comments on commit 1be5d7f

Please sign in to comment.