Skip to content

Commit

Permalink
adding new world IDs in filtering partners related to #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Girard committed Feb 24, 2015
1 parent a5d4521 commit 4d7ec1e
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions client/js/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ angular.module('ricardo.directives', [])
}
}
}])
.directive('stackedTimelineCountry',[ 'cfSource', 'cfTarget', 'cfSourceLine', 'fileService', 'apiService', '$timeout','$modal',
function (cfSource, cfTarget, cfSourceLine, fileService, apiService, $timeout,$modal){
.directive('stackedTimelineCountry',[ 'cfSource', 'cfTarget', 'cfSourceLine', 'fileService', 'apiService', '$timeout','$modal','DEFAULT_REPORTING',
function (cfSource, cfTarget, cfSourceLine, fileService, apiService, $timeout,$modal,DEFAULT_REPORTING){
return {
restrict: 'A',
replace: false,
Expand Down Expand Up @@ -346,7 +346,7 @@ angular.module('ricardo.directives', [])
cfSourceLine.year().filterRange(d)

scope.tableData = cfSource.year().top(Infinity).concat(cfTarget.year().top(Infinity))
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})

scope.barchartData.forEach(function(d){
d.continent = scope.RICentities[d.key+""].continent
Expand Down Expand Up @@ -436,7 +436,7 @@ angular.module('ricardo.directives', [])

scope.tableData = cfSource.year().top(Infinity).concat(cfTarget.year().top(Infinity))

scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})

scope.barchartData.forEach(function(d){
d.continent = scope.RICentities[d.key+""].continent
Expand Down Expand Up @@ -597,7 +597,7 @@ angular.module('ricardo.directives', [])
scope.$watch("gbContinent", function(newValue, oldValue){
if(newValue != oldValue){
if(!newValue){
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})
}
}
}, true)
Expand All @@ -606,14 +606,14 @@ angular.module('ricardo.directives', [])
if(newValue != oldValue){
if(newValue == "all"){
cfSource.type().filterAll()
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})
scope.barchartData.forEach(function(d){
d.continent = scope.RICentities[d.key+""].continent
})

}else{
cfSource.type().filterExact(newValue)
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})
scope.barchartData.forEach(function(d){
d.continent = scope.RICentities[d.key+""].continent
})
Expand Down Expand Up @@ -723,7 +723,7 @@ angular.module('ricardo.directives', [])
cfSourceLine.year().filterRange(d)

scope.tableData = cfSource.year().top(Infinity).concat(cfTarget.year().top(Infinity))
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})

scope.linechartData = d3.nest().key(function(d){return d.reporting_id}).entries(cfSourceLine.year().top(Infinity))

Expand Down Expand Up @@ -808,7 +808,7 @@ angular.module('ricardo.directives', [])
scope.tableData = cfSource.year().top(Infinity).concat(cfTarget.year().top(Infinity))


scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})

var flowsPerYear = cfSource.years().top(Infinity)

Expand Down Expand Up @@ -956,18 +956,19 @@ angular.module('ricardo.directives', [])
if(newValue != oldValue){
if(newValue == "all"){
cfSource.type().filterAll()
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})
}else{
cfSource.type().filterExact(newValue)
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return d.key != 442})
scope.barchartData = cfSource.partners().top(Infinity).filter(function(d){return !d.key.match(/World*/)})
}
}
})

}
}
}])
.directive('stackedTimelineWorld',[ 'cfSource', 'cfTarget','fileService', 'apiService', '$timeout','$modal',function (cfSource, cfTarget, fileService, apiService, $timeout, $modal){
.directive('stackedTimelineWorld',[ 'cfSource', 'cfTarget','fileService', 'apiService', '$timeout','$modal','DEFAULT_REPORTING',
function (cfSource, cfTarget, fileService, apiService, $timeout, $modal,DEFAULT_REPORTING){
return {
restrict: 'A',
replace: false,
Expand Down Expand Up @@ -1035,7 +1036,7 @@ angular.module('ricardo.directives', [])
var initEntity = function(sourceID){
var ids = sourceID.map(function(d){return d.RICid})
apiService
.getFlows({reporting_ids:ids.join(","), partner_ids: 442})
.getFlows({reporting_ids:ids.join(","), partner_ids: "Worldestimated"})
.then(
function(data){

Expand Down Expand Up @@ -1091,7 +1092,7 @@ angular.module('ricardo.directives', [])
var initContinent = function(sourceID){
var ids = sourceID.map(function(d){return d.RICname})
apiService
.getContinentFlows({continents:ids.join(","), partner_ids: 442})
.getContinentFlows({continents:ids.join(","), partner_ids: "Worldestimated"})
.then(
function(data){

Expand Down Expand Up @@ -1144,8 +1145,8 @@ angular.module('ricardo.directives', [])
}

/* start initialize */
scope.reporting =scope.reportingCountryEntities.filter(function(e){return e.RICid==DEFAULT_REPORTING})[0]

scope.reporting =scope.reportingCountryEntities.filter(function(e){return e.RICid==DEFAULT_REPORTING})
init(scope.reporting)

/* end initialize */
Expand Down

0 comments on commit 4d7ec1e

Please sign in to comment.