"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "api/parts/data/fetch.js" between
countly-server-20.04.1.4.tar.gz and countly-server-20.04.1.5.tar.gz

About: countly-server is a mobile & web analytics, push notifications and crash reporting platform. This is the server part that collects and analyzes data while individual client SDKs (mobile, web or desktop) send the data. Community Edition (commercial Enterprise Edition also available).

fetch.js  (countly-server-20.04.1.4):fetch.js  (countly-server-20.04.1.5)
skipping to change at line 601 skipping to change at line 601
if (res) { if (res) {
items = res; items = res;
var total = 0; var total = 0;
for (let k = 0; k < items.length; k++) { for (let k = 0; k < items.length; k++) {
items[k].percent = items[k].t; items[k].percent = items[k].t;
items[k].value = items[k].t; items[k].value = items[k].t;
items[k].name = items[k]._id; items[k].name = items[k]._id;
total = total + items[k].value; total = total + items[k].value;
} }
var totalPercent = 0; var totalPercent = 0;
for (let k = 0; k < items.length; k++) { for (let k = items.length - 1; k >= 0; k--) {
if (k !== (items.length - 1)) { if (k !== 0) {
items[k].percent = Math.floor(items[k].percent * 100 / total ); items[k].percent = Math.floor(items[k].percent * 100 / total );
totalPercent += items[k].percent; totalPercent += items[k].percent;
} }
else { else {
items[k].percent = 100 - totalPercent; items[k].percent = 100 - totalPercent;
} }
} }
} }
callback(items); callback(items);
}); });
skipping to change at line 1376 skipping to change at line 1376
if any metric change happened in the selected period and include this in the result if any metric change happened in the selected period and include this in the result
*/ */
options.db.collection("metric_changes" + params.app_id). aggregate([ options.db.collection("metric_changes" + params.app_id). aggregate([
{$match: metricChangesMatch}, {$match: metricChangesMatch},
{ {
$group: { $group: {
_id: '$' + shortcodesForMetrics[metric] + ". o", _id: '$' + shortcodesForMetrics[metric] + ". o",
uniqDeviceIds: { $addToSet: '$uid'} uniqDeviceIds: { $addToSet: '$uid'}
} }
}, },
{$unwind: "$uniqDeviceIds"},
{ {
$group: { $project: {
_id: "$_id", _id: "$_id",
u: { $sum: 1 } u: { $size: "$uniqDeviceIds" }
} }
} }
], { allowDiskUse: true }, function(err, metricChangesDb Result) { ], { allowDiskUse: true }, function(err, metricChangesDb Result) {
if (metricChangesDbResult) { if (metricChangesDbResult) {
var appUsersDbResultIndex = _.pluck(appUsersDbRe sult, '_id'); var appUsersDbResultIndex = _.pluck(appUsersDbRe sult, '_id');
for (let i = 0; i < metricChangesDbResult.length ; i++) { for (let i = 0; i < metricChangesDbResult.length ; i++) {
var itemIndex = appUsersDbResultIndex.indexO f(metricChangesDbResult[i]._id); var itemIndex = appUsersDbResultIndex.indexO f(metricChangesDbResult[i]._id);
if (itemIndex === -1) { if (itemIndex === -1) {
appUsersDbResult.push(metricChangesDbRes ult[i]); appUsersDbResult.push(metricChangesDbRes ult[i]);
} }
else { else {
appUsersDbResult[itemIndex].u += metricC hangesDbResult[i].u; appUsersDbResult[itemIndex].u += metricC hangesDbResult[i].u;
} }
} }
} }
callback(appUsersDbResult); callback(appUsersDbResult || {});
}); });
} }
else { else {
callback(appUsersDbResult); callback(appUsersDbResult || {});
} }
}); });
} }
} }
else { else {
callback(ob.result); callback(ob.result);
} }
}); });
}; };
 End of changes. 6 change blocks. 
7 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)