Closed pfitzpaddy closed 4 years ago
Adding the new activity types to active ET projects
// add new activities
db.getCollection('project').find({ admin0pcode:'ET', cluster_id:'esnfi', project_end_date: { $gte: new ISODate('2020-01-01') } }).forEach(function(d){
var esnfi = {
"cluster_id" : "esnfi",
"cluster" : "ESNFI",
"activity_type_id" : "esnfi_distribution",
"activity_type_name" : "ESNFI Distribution"
}
var shelter = {
"cluster_id" : "esnfi",
"cluster" : "ESNFI",
"activity_type_id" : "shelter_reconstruction_repair",
"activity_type_name" : "Shelter Reconstruction/Repair"
}
d.activity_type.push(esnfi)
d.activity_type.push(shelter)
db.getCollection('project').save(d);
});
Adding the new activity types to all projects
// add disabled
db.getCollection('project').find({ admin0pcode: 'ET', cluster_id:'esnfi' }).forEach(function(d){
// update activities to disabled
for (i = 0; i < d.activity_type.length; i++) {
if ( d.activity_type[ i ].activity_type_id !== "esnfi_distribution" &&
d.activity_type[ i ].activity_type_id !== "shelter_reconstruction_repair" ) {
d.activity_type[ i ].disabled = 1;
}
}
db.getCollection('project').save(d);
});
@drfaustusfade, @fakhrihawari, I have made a temporary workaround for new lists in this commit
active
in the activities.csvdisabled
tag in the existing project.definition.activity_type
s that are no longer required (db update above)beneficiary.id
), only the active:1
lists are available, whereas for existing beneficiaries (benficiary.id
exists), the entire list is displayed so that the dropdown will display correctly.Its extra code in the HTML but I was running out of time - and it works for now.
Activity/Description/SO
ESNFI In-Kind
ESNFI in Cash
ESNFI mixed (Cash + In-Kind)
Partial ESNFI kit
Emergency Shelter Repair kits (Full)
Emergency Shelter Repair kits (Partial)
Cash for Shelter/rent
Minor Shelter Repair kits
Cash for Shelter- communal shelters
Cash for partial repair-Minor
Emergency Shelter Repair Kits Mixed (Cash + In-Kind)