Project

General

Profile

1
use openaire_admin;
2

    
3
var communities = db.community.find().map( function(entity) { return entity._id.str; } );
4
print(communities);
5
for(var i =0; i < communities.length; i++){
6
    print(communities[i]);
7
    var communityPid = communities[i];
8
    var charts_map = {};
9
        charts_map["total"] = { "showInDashboard" : true, "showInDashboard" : false };
10
        charts_map["project"] = { "showInDashboard" : true, "showInDashboard" : false };
11
        charts_map["open"] = { "showInDashboard" : true, "showInDashboard" : false };
12
        charts_map["closed"] = { "showInDashboard" : true, "showInDashboard" : false };
13
        charts_map["embargo"] = { "showInDashboard" : true, "showInDashboard" : false };
14

    
15
        var charts = {"map":charts_map};
16
        var numbers_map = {};
17
            numbers_map["timeline"] = { "showInDashboard" : true, "showInDashboard" : false };
18
            numbers_map["graph"] = { "showInDashboard" : true, "showInDashboard" : false };
19
            numbers_map["projectTable"] = { "showInDashboard" : true, "showInDashboard" : false };
20
            numbers_map["projectColumn"] = { "showInDashboard" : true, "showInDashboard" : false };
21
            numbers_map["projectPie"] = { "showInDashboard" : true, "showInDashboard" : false };
22

    
23
        var numbers = {"map":numbers_map};
24
        var statistics_entities = {"charts":charts,"numbers":numbers}
25
        var entities = {};
26
        entities["publication"]=statistics_entities;
27
        entities["dataset"]=statistics_entities;
28
        entities["sofware"]=statistics_entities;
29
        var statistics = {"pid" : communityPid, "entities" : entities};
30

    
31
        db.statistics.save(statistics);
32
        print("Update stats for " + communityPid)
33
}
(3-3/3)