Open dondippino opened 4 years ago
there was duplication issue on using inform save again before records are saved with no id records https://github.com/pfitzpaddy/ngm-reportDesk/issues/355, fixed yesterday
Should the report be saved again to rectify the error?
duplicates should be cleaned up by deleting from the report
Okay thank you
Script to find duplicates in a report (assuming records could not be exactly the same)
// script to find duplicates in a report (assuming records could not be exactly the same)
var objReportByBeneficiaryIds = {};
db.getCollection("beneficiaries").find({report_id: "5e5b17233aa441270ea8d6c9"}).forEach(function(d){
_id = d._id;
delete d.createdAt;
delete d.updatedAt;
delete d._id;
delete d.report_submitted;
objReportByBeneficiaryIds[_id] = JSON.stringify(d);
});
// print(Object.keys(objReportByBeneficiaryIds));
var arrDuplicateBeneficiaryIds = [];
var arrFirstBeneficiaryIds = [];
Object.keys(objReportByBeneficiaryIds).forEach(function(b){
// print('beneficiary:', b);
Object.keys(objReportByBeneficiaryIds).forEach(function(b_to_compare){
if (b!==b_to_compare){
// print('compare to:', b_to_compare);
if (objReportByBeneficiaryIds[b]===objReportByBeneficiaryIds[b_to_compare] && arrFirstBeneficiaryIds.indexOf(b_to_compare)<0 && arrDuplicateBeneficiaryIds.indexOf(b_to_compare)<0){
arrFirstBeneficiaryIds.push(b);
arrDuplicateBeneficiaryIds.push(b_to_compare);
// print ('duplicate:', b_to_compare);
}
}
});
});
print(arrDuplicateBeneficiaryIds);
//arrDuplicateBeneficiaryIds.forEach(function(db){print(db)});
@dondippino please check above script if it works for your data, as an alternative of removing from db directly if needed
There is a bug on the Monthly reporting page of ReportHub, (probably from a recent push). The numbers of reported activities seems to have multiple appearances on the Actual Monthly progress page. See link for clarity: https://reporthub.org/desk/#/cluster/projects/report/5cab1ded25182bc37fe5d8bc/5e5b17233aa441270ea8d6c9