function computeDiffSubmittedFacesBetweenExhibitions(round, ex) { var set, faces, other_faces = []; if (ex === 'A') { set = ['B','C']; } else if (ex === 'B') { set = ['A','C']; } else { set = ['B','A']; } // faces submitted to other exhibitions J.each(set, function(ex) { other_faces = other_faces.concat(prac.getSubmittedFacesByEx(db, ex, round).fetch()); }); // faces in ex of reference faces = prac.getSubmittedFacesByEx(db, ex, round).fetch(); if ('undefined' === typeof faces || !faces.length || faces.length === 1) return 'NA'; if ('undefined' === typeof other_faces || !other_faces.length || other_faces.length === 1) return 'NA'; return prac.getAvgFaceDistanceGroupFromGroup(faces, other_faces); }
J.each(set, function(ex) { other_faces = other_faces.concat(prac.getSubmittedFacesByEx(db, ex, round).fetch()); });
function computeDiffSubmittedFaces(round, ex) { //console.log(round, ex); var faces = prac.getSubmittedFacesByEx(db, ex, round).fetch(); return ('undefined' === typeof faces || !faces.length) ? 'NA' : prac.getAvgFaceDistance(faces); }