forked from dsjoerg/ggtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathecon_staircase.js
More file actions
41 lines (33 loc) · 1.18 KB
/
econ_staircase.js
File metadata and controls
41 lines (33 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
gg.controller('EconomyStaircaseController', ['$scope', '$element', '$urlFilter', 'EconStaircase',
function ($scope, $element, $urlFilter, EconStaircase) {
$scope.race = 'protoss';
$scope.vs_race = 'zerg';
$scope.metrictype = 2; // start out showing fit by default
$scope.metrictypes = ['median', 'mean', 'fit'];
$scope.leagues = [1,2,3,4,5];
$scope.filter = $urlFilter;
$scope.unit = null;
$scope.es = new EconStaircase.get({});
$scope.filter.defaults = {
race: 'protoss',
vs_race: 'zerg',
}
$scope.filter.onChange = function(){
$scope.filter.apply($scope);
}
$scope.flipMetric = function() {
$scope.metrictype = ($scope.metrictype + 1) % 3;
}
$scope.metric = function() {
return $scope.metrictypes[$scope.metrictype];
}
$scope.criterion = function() {
return $scope.metrictype == 1 ? 'Saturated' : 'Completed';
}
$scope.$watch('race + vs_race', function(v) {
$scope.filter.params.race = $scope.race;
$scope.filter.params.vs_race = $scope.vs_race;
$scope.key = $scope.race[0].toUpperCase() + 'v' + $scope.vs_race[0].toUpperCase();
});
}
]);