Update function which split some report values into arrays. More views for pie charts.

This commit is contained in:
Kevin Gaudin 2012-12-09 02:06:26 +01:00
parent 6f0d2b6cfb
commit 4d027b4725
12 changed files with 95 additions and 1 deletions

1
.ericaignore Normal file
View File

@ -0,0 +1 @@
[".idea"]

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea

59
updates/report.js Normal file
View File

@ -0,0 +1,59 @@
/**
* Inserts a reception timestamp and transforms some multiple values fields into arrays.
**/
function(doc,req) {
var data = JSON.parse(req.body);
data.timestamp = new Date();
data.user_ip = req.peer;
data["_id"] = data.REPORT_ID;
if(data.STACK_TRACE) {
data.STACK_TRACE = data.STACK_TRACE.split('\n');
}
if(data.LOGCAT) {
data.LOGCAT = data.LOGCAT.split('\n');
}
if(data.RADIOLOG) {
data.RADIOLOG = data.RADIOLOG.split('\n');
}
if(data.EVENTSLOG) {
data.EVENTSLOG = data.EVENTSLOG.split('\n');
}
if(data.SETTINGS_SECURE.ENABLED_INPUT_METHODS) {
data.SETTINGS_SECURE.ENABLED_INPUT_METHODS = data.SETTINGS_SECURE.ENABLED_INPUT_METHODS.split(':');
}
if(data.SETTINGS_SYSTEM.AIRPLANE_MODE_RADIOS) {
data.SETTINGS_SYSTEM.AIRPLANE_MODE_RADIOS = data.SETTINGS_SYSTEM.AIRPLANE_MODE_RADIOS.split(',');
}
if(data.SETTINGS_GLOBAL.AIRPLANE_MODE_RADIOS) {
data.SETTINGS_GLOBAL.AIRPLANE_MODE_RADIOS = data.SETTINGS_GLOBAL.AIRPLANE_MODE_RADIOS.split(',');
}
if(data.SETTINGS_GLOBAL.AIRPLANE_MODE_TOGGLEABLE_RADIOS) {
data.SETTINGS_GLOBAL.AIRPLANE_MODE_TOGGLEABLE_RADIOS = data.SETTINGS_GLOBAL.AIRPLANE_MODE_TOGGLEABLE_RADIOS.split(',');
}
if(data.INITIAL_CONFIGURATION.screenLayout) {
data.INITIAL_CONFIGURATION.screenLayout = data.INITIAL_CONFIGURATION.screenLayout.split('+');
}
if(data.INITIAL_CONFIGURATION.uiMode) {
data.INITIAL_CONFIGURATION.uiMode = data.INITIAL_CONFIGURATION.uiMode.split('+');
}
if(data.CRASH_CONFIGURATION.screenLayout) {
data.CRASH_CONFIGURATION.screenLayout = data.CRASH_CONFIGURATION.screenLayout.split('+');
}
if(data.CRASH_CONFIGURATION.uiMode) {
data.CRASH_CONFIGURATION.uiMode = data.CRASH_CONFIGURATION.uiMode.split('+');
}
// This causes Error 500...
/* if(data.DISPLAY) {
data.DISPLAY.forEach( function(d) {
if(d.flags){
d.flags = d.flags.split('+');
}
});
}
*/
data.requestHeaders = req.headers;
message = "OK";
return [ data, message];
}

View File

@ -0,0 +1,5 @@
function(doc) {
if(doc.BUILD.VERSION.SDK) {
emit(doc.BUILD.VERSION.SDK, 1);
}
}

View File

@ -0,0 +1,3 @@
function(keys, values, rereduce) {
return sum(values);
}

View File

@ -0,0 +1,5 @@
function(doc) {
if(doc.ANDROID_VERSION) {
emit(doc.ANDROID_VERSION, 1);
}
}

View File

@ -0,0 +1,3 @@
function(keys, values, rereduce) {
return sum(values);
}

View File

@ -0,0 +1,5 @@
function(doc) {
if(doc.APP_VERSION_CODE) {
emit(doc.APP_VERSION_CODE, 1);
}
}

View File

@ -0,0 +1,3 @@
function(keys, values, rereduce) {
return sum(values);
}

View File

@ -0,0 +1,5 @@
function(doc) {
if(doc.APP_VERSION_NAME) {
emit(doc.APP_VERSION_NAME, 1);
}
}

View File

@ -0,0 +1,3 @@
function(keys, values, rereduce) {
return sum(values);
}

View File

@ -2,7 +2,7 @@ function(doc) {
if(doc.USER_CRASH_DATE) {
var crashDate = new Date(doc.USER_CRASH_DATE);
if(crashDate.getFullYear() > 2000) {
emit([crashDate.getFullYear(), crashDate.getMonth() , crashDate.getDate()], 1);
emit([crashDate.getFullYear(), crashDate.getMonth() , crashDate.getDate(), crashDate.getHours(), crashDate.getMinutes(), crashDate.getSeconds(), crashDate.getMilliseconds()], 1);
}
}
}