Commit 7162aca4 authored by pet's avatar pet

Media dos testes congruentes

parent 2e6dbbd2
......@@ -217,14 +217,52 @@ function downloadCsv(){
ordemFiltrada = filtraOrdemBateria(dataSet[0].ordemBateria);
lines = {};
function scpAspas(t){
return "'"+t+"'";
}
var tabela = [];
tabela.push([]);
tabela[0][0] = "''";
lines[0] = "''"
var congruenteIndex = [];
var incongruenteIndex = [];
for(i in ordemFiltrada){
if(ordemFiltrada[i] == "C" || ordemFiltrada[i] == "I"){
lines[0]+=","+ordemFiltrada[i];
if(ordemFiltrada[i] == "C"){
congruenteIndex.push(i);
//tabela[0].push(","+scapeAspasSimples(ordemFiltrada[i]));
}
if(ordemFiltrada[i] == "I"){
incongruenteIndex.push(i);
}
}
var numCongruentes = congruenteIndex.length;
var numIncongruentes = incongruenteIndex.length;
for(var i = 0; i < numCongruentes; i++){
tabela[0].push(",'C "+(i+1)+"'");
}
tabela[0].push(",'Média C','Dev Pad C', 'Erro C', 'Acertos C'");
for(var i = 0; i < numCongruentes; i++){
tabela[0].push(",'C "+(i+1)+"'");
}
tabela[0].push(",'Média C M','Dev Pad C M', 'Erro C M', 'Acertos C M'");
for(var i = 0; i < numIncongruentes; i++){
tabela[0].push(",'I "+(i+1)+"'");
}
tabela[0].push(",'Média I','Dev Pad I', 'Erro I', 'Acertos I'");
for(var i = 0; i < numIncongruentes; i++){
tabela[0].push(",'I "+(i+1)+"'");
}
tabela[0].push(",'Média I M','Dev Pad I M', 'Erro I M', 'Acertos I M'");
var dicionario = {}
for(var i in dataSet){
......@@ -236,16 +274,39 @@ function downloadCsv(){
}
}
function mediaTeste(teste){
var acertos = 0;
var soma = 0;
for(var i in teste){
if(teste[i].acertou){
soma+=teste[i].tempo;
acertos++;
}
}
var media = 0;
if(acertos > 0){
media = (soma/acertos);
}
return {media: media, acertos: acertos};
}
for(p in dicionario){
pessoa = dicionario[p];
var line = [];
var pessoa = dicionario[p];
for(b in pessoa){
bateria = pessoa[b];
if(grupo == 0){
var bateria = pessoa[b];
if(bateria.grupo == 1){
for(var j in congruenteIndex){
media = mediaTeste(bateria.stringResposta[j]);
line.push(","+scpAspas(media.media))
}
}
}
tabela.push(line);
}
console.log(tabela);
console.log(dicionario);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment