-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathteam.html
202 lines (184 loc) · 8.56 KB
/
team.html
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Time logger report</title>
<style>
body {
background-color:white;
}
#header {
font-size:3em;
margin-bottom:30px;
}
#timestamp {
font-size:small;
}
#container {
max-width: 1600px;
min-width: 1300px;
}
.course {
margin: 1em 0;
}
.header {
font-size:2em;
margin-top:3em;
}
.chart {}
.table {}
.google-visualization-table-th {min-width:4em;}
.even {page-break-after: always}
</style>
</head>
<body>
<div id='header'>
Time logger report
<div id='timestamp'></div>
</div>
<div id="container">
</div>
<script>
var settings = settings || {
report_path: 'team.csv', // path to the team report produced by the team_report.py
enable_total: true, // add Total Workload metaproject (will be place topmost)
enable_average: true, // append Average column to tables and charts
enable_std: true, // append Standard Deviation to tables. This is an indicator of how balanced is the team effort
chart_options: { // see https://developers.google.com/chart/interactive/docs/gallery/linechart#configuration-options
chartArea: {left:'5%',top:'5%',width:'75%',height:'85%'},
vAxis: {baseline: 0},
pointShape: 'square',
pointSize: 15,
width: 1100,
height: 430
},
// settings specific for the Software Engineering program
// set of core courses, in exactly the same order as it will appear in the report
// Everything not in this list will be counted as electives
core_projects: [ // some duplication with details.html
// TODO: move settings to an external js file
'17-671 Software Development Studio I',
'17-672 Software Development Studio II',
'17-673 Software Development Studio III',
'17-677 MSIT Project I',
'17-678 MSIT Project II',
'17-651 Models of Software Systems',
'17-652 Methods: Deciding What to Design',
'17-653 Managing Software Development',
'17-654 Analysis of Software Artifacts',
'17-655 Architectures for Software Systems',
'17-656 Communication for Software Engineers I',
'17-657 Communication for Software Engineers II'
],
// courses not in core_projects will be aggregated in this meta-course
everything_else: 'electives', // has to be different from core_projects
total_label: 'Total', // has to be different from core_projects and everything_else
average_label: 'Avg',
std_label: 'Std',
empty_week_label: '-'
};
</script>
<script src="https://www.google.com/jsapi"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/PapaParse/4.1.2/papaparse.min.js"></script>
<script>
google.load("visualization", "1", {packages:["table", "corechart"]});
google.setOnLoadCallback(function () {
Papa.parse(settings.report_path, {
download: true,
complete: function (results) {
// columns are ream, proj, avg, std, [week_labels, .., avg, std]
var week_labels = results.data[0].slice(4),
report_data = {}; /* courses is an array of prepared data
report_data[proj][team] = {
data: [], // same length as week_labels
avg: average,
std: standard_deviation
} to see whether at least one team was working on this project */
// margin week_labels to make space for at least one quarter
while (week_labels.length < 12) week_labels.push(settings.empty_week_label);
settings.core_projects.push(settings.everything_else); // will come last
if (settings.enable_total) settings.core_projects.unshift(settings.total_label);
function add_record(team, proj, str_data, str_avg, str_std) {
var avg = parseFloat(str_avg),
std = parseFloat(str_std),
data = [];
for (var i=0; i < str_data.length; i++) data.push(parseFloat(str_data[i]));
while (data.length < week_labels.length) data.push(null);
if (!(proj in report_data)) report_data[proj] = {};
if (team in report_data[proj]) { // it was already added, merge (e.g. if proj is not in core_projects)
for (var j=0; j<data.length; j++)
if (data[j]) report_data[proj][team]['data'][j] += data[j];
report_data[proj][team]['avg'] += avg;
report_data[proj][team]['std'] = 0;
}
else report_data[proj][team] = {
data: data,
avg: avg,
std: std
};
}
for (var i=1; i < results.data.length; i++) {
var team = results.data[i][0],
proj = results.data[i][1],
avg = results.data[i][2],
std = results.data[i][3],
data = results.data[i].slice(4);
if (!team) continue; // e.g. extra newline at the end of the CSV
if (settings.core_projects.indexOf(proj)<0) proj = settings.everything_else;
add_record(team, proj, data, avg, std);
if (settings.enable_total) add_record(team,settings.total_label,data,avg,std);
}
// draw the charts
var even = true;
settings.core_projects.forEach(function(proj, index){
if (!(proj in report_data)) return;
even = !even;
$('#container').append(
"<div class='"+index+(even ? " even": "")+"' id='"+proj+"-container'>" +
"<div class='header' id='"+proj+"-header'>" + proj + "</div>" +
"<div class='chart' id='"+proj+"-chart'>" + "</div>" +
"<div class='table' id='"+proj+"-table'>" + "</div>" +
"</div>");
// Tables
var data = new google.visualization.DataTable();
data.addColumn('string', 'Team');
week_labels.forEach(function(week) {data.addColumn('number', week);});
if (settings.enable_average)
data.addColumn('number', settings.average_label);
if (settings.enable_std && proj != settings.total_label && proj != settings.everything_else)
data.addColumn('number', settings.std_label);
for (team in report_data[proj]) {
// we don't want to change the report_data (e.g. charts don't use std)
var row = [team].concat(report_data[proj][team]['data']);
if (settings.enable_average)
row.push(report_data[proj][team]['avg']);
if (settings.enable_std && proj != settings.total_label && proj != settings.everything_else)
row.push(report_data[proj][team]['std']);
data.addRow(row);
}
var table = new google.visualization.Table(document.getElementById(proj + '-table'));
table.draw(data, {showRowNumber: false});
// Charts
data = new google.visualization.DataTable();
data.addColumn('string', 'Week');
for (team in report_data[proj]) data.addColumn('number', team);
week_labels.forEach(function(week, i) {
var row = [week];
for (team in report_data[proj])
row.push(report_data[proj][team]['data'][i]);
data.addRow(row);
});
if (settings.enable_average) {
var row = [settings.average_label];
for (team in report_data[proj])
row.push(report_data[proj][team]['avg']);
data.addRow(row);
}
var chart = new google.visualization.LineChart(document.getElementById(proj + '-chart'));
chart.draw(data, settings.chart_options);
});
}
});
});
</script>