Skip to content

Commit 554967b

Browse files
author
Christoph Wolfes
committed
refactored code
1 parent c47f3d7 commit 554967b

File tree

4 files changed

+34
-31
lines changed

4 files changed

+34
-31
lines changed

Diff for: src/main/chart/chartController.js

+25-22
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,6 @@ angular.module('adf.widget.redmine')
77
vm.config = config;
88
vm.issues = issues;
99

10-
var calculateOpenIssuesPerDay = function (from, to, issues) {
11-
// order issues by creation date
12-
var openIssues = []; // inv: ordered by "closed_on"
13-
var dates = [];// x-values
14-
var values = [];// y-values
15-
while (from.getTime() <= to.getTime()) {
16-
moveNewOpenIssues(issues, openIssues, from);
17-
removeNewClosedIssues(openIssues, from);
18-
dates.push(from.toDateString());
19-
values.push(openIssues.length)
20-
from.setDate(from.getDate() + 1); // next day
21-
}
22-
return {
23-
dates: dates,
24-
values: values
25-
}
26-
}
2710
var moveNewOpenIssues = function (allIssues, openIssues, date) {
2811
//console.log("allIssues.length "+allIssues.length);
2912
for (var i = 0; i < allIssues.length; i++) {
@@ -37,7 +20,7 @@ angular.module('adf.widget.redmine')
3720
break;
3821
}
3922
}
40-
}
23+
};
4124

4225
var removeNewClosedIssues = function (openIssues, date) {
4326
for (var i = 0; i < openIssues.length; i++) {
@@ -51,7 +34,27 @@ angular.module('adf.widget.redmine')
5134
}
5235
}
5336
}
54-
}
37+
};
38+
39+
40+
var calculateOpenIssuesPerDay = function (from, to, issues) {
41+
// order issues by creation date
42+
var openIssues = []; // inv: ordered by "closed_on"
43+
var dates = [];// x-values
44+
var values = [];// y-values
45+
while (from.getTime() <= to.getTime()) {
46+
moveNewOpenIssues(issues, openIssues, from);
47+
removeNewClosedIssues(openIssues, from);
48+
dates.push(from.toDateString());
49+
values.push(openIssues.length);
50+
from.setDate(from.getDate() + 1); // next day
51+
}
52+
return {
53+
dates: dates,
54+
values: values
55+
};
56+
};
57+
5558

5659
if (vm.config.timespan && vm.config.timespan.fromDateTime && vm.config.timespan.toDateTime) {
5760
var from = new Date(vm.config.timespan.fromDateTime);
@@ -74,15 +77,15 @@ angular.module('adf.widget.redmine')
7477
},
7578
legend: {
7679
display: true,
77-
position: "bottom"
80+
position: 'bottom'
7881
}
7982
};
8083

8184
vm.chart = {
8285
labels: generatedData.dates,
8386
data: [generatedData.values],
84-
series: ["Project ..."],
85-
class: "chart-line",
87+
series: ['Project ...'],
88+
class: 'chart-line',
8689
options: options
8790
};
8891
}

Diff for: src/main/issues/edit/editIssuesController.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
angular.module('adf.widget.redmine')
44
.controller('editIssuesController', function(projects, config){
55
var vm = this;
6-
console.log("config: "+config);
6+
console.log('config: '+config);
77
vm.possibleColumns = {
8-
"id":{"name":"ID", "show": true},
9-
"tracker":{"name":"Tracker","show": true},
10-
"status":{"name":"Status","show": true},
11-
"subject":{"name":"Subject","show": true}
8+
'id':{'name':'ID', 'show': true},
9+
'tracker':{'name':'Tracker','show': true},
10+
'status':{'name':'Status','show': true},
11+
'subject':{'name':'Subject','show': true}
1212
};
1313

1414
if(angular.equals({},config)) {
1515
config.columns=vm.possibleColumns;
16-
config.project="";
17-
config.assigned_to_id="me";
16+
config.project='';
17+
config.assigned_to_id='me';
1818
config.showClosed=false;
1919
}
2020

Diff for: src/main/redmine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
angular.module('adf.widget.redmine', ['adf.provider', 'smart-table', 'chart.js', 'ui.bootstrap.datepicker'])
4-
.constant("redmineEndpoint", "http://www.redmine.org/")
4+
.constant('redmineEndpoint', 'http://www.redmine.org/')
55
.config(function (dashboardProvider) {
66

77
var editIssues = {

Diff for: src/main/service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ angular.module('adf.widget.redmine')
3636
return allIssues;
3737
}
3838

39-
})
39+
});
4040
}
4141

4242
function collectPageIssues(params, offset){

0 commit comments

Comments
 (0)