Skip to content

Commit 52a28c0

Browse files
temporary workaround for "avg" apply
1 parent 6e11c89 commit 52a28c0

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

source/js/DataController.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,13 @@ DataController.prototype.resetRawData = function () {
286286
} else {
287287
summary[i] = {
288288
// very hard workaround (applying "avg" last column spec)
289-
//value: ((rawData[x].length - 1 === parseInt(i)
290-
// && _.controller.CONFIG["_temp_lastColSpec"]
291-
// && _.controller.CONFIG["_temp_lastColSpec"]["levelSummary"] === "avg")
292-
// ? countAverageByColumn
293-
// : countSummaryByColumn)(rawData, xh, rawData.length - 1, i),
294-
value: (countSummaryByColumn)(rawData, xh, rawData.length - 1, i),
289+
value: ((rawData[x].length - 1 === parseInt(i)
290+
&& _.controller.CONFIG["_temp_lastColSpec"]
291+
&& _.controller.CONFIG["_temp_lastColSpec"]["levelSummary"] === "avg")
292+
? countAverageByColumn
293+
: countSummaryByColumn)(rawData, xh, rawData.length - 1, i),
294+
// end
295+
//value: (countSummaryByColumn)(rawData, xh, rawData.length - 1, i),
295296
style: "font-weight: 900;"
296297
}
297298
}

source/js/DataSource.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,21 @@ DataSource.prototype.getCurrentData = function (callback) {
156156
}
157157

158158
// temporary hard workaround (getting last column specs)
159-
//_.GLOBAL_CONFIG["_temp_lastColSpec"] = (function (lev) {
160-
// var tc = lev,
161-
// f = function (lev) {
162-
// if (lev["childLevels"] && lev["childLevels"].length > 0) {
163-
// for (var i in lev["childLevels"]) {
164-
// f(lev["childLevels"][i]);
165-
// }
166-
// } else {
167-
// tc = lev;
168-
// }
169-
// };
170-
// if (lev) f(lev);
171-
// return tc;
172-
//})(data["columnLevels"][data["columnLevels"].length - 1]);
159+
_.GLOBAL_CONFIG["_temp_lastColSpec"] = (function (lev) {
160+
var tc = lev,
161+
f = function (lev) {
162+
if (lev["childLevels"] && lev["childLevels"].length > 0) {
163+
for (var i in lev["childLevels"]) {
164+
f(lev["childLevels"][i]);
165+
}
166+
} else {
167+
tc = lev;
168+
}
169+
};
170+
if (lev) f(lev);
171+
return tc;
172+
})(data["columnLevels"][data["columnLevels"].length - 1]);
173+
// end
173174

174175
};
175176

0 commit comments

Comments
 (0)