Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new cell errors to usability metrics #116

Open
wants to merge 8 commits into
base: pacesetters
Choose a base branch
from
Open
14 changes: 8 additions & 6 deletions client/app/controllers/tableController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['jquery', 'Handsontable', 'table_template', 'filesaver', 'alertify', 'qtip'], function ($, Handsontable, table_template, filesaver, alertify) {
define(['jquery','controllers/usabilityController', 'Handsontable', 'table_template', 'filesaver', 'alertify', 'qtip'], function ($, usabilityController, Handsontable, table_template, filesaver, alertify) {

'use strict';

Expand Down Expand Up @@ -567,11 +567,13 @@ define(['jquery', 'Handsontable', 'table_template', 'filesaver', 'alertify', 'qt
beforeChange: function (changes, source) {
return !(this.readOnly);
},
afterSetDataAtCell: function (changes, source) {
//update_width(this);
},
afterChange: function (row, column) {
//update_width(this);
afterSetDataAtCell: function (changes) {
var cellInput = changes[0][3];
if (cellInput === '') {
usabilityController.addValidationError('EMPTY_CELL');
} else if (isNaN(parseInt(cellInput))) {
usabilityController.addValidationError('INVALID_CELL');
}
}
};

Expand Down
4 changes: 4 additions & 0 deletions client/app/controllers/usabilityController.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ define(['table_template'], function (table_template) {
}

function addValidationError(err) {

if (analytics.validation_errors[err] === undefined) {
return;
}
analytics.validation_errors[err] += 1;
}

Expand Down
4 changes: 2 additions & 2 deletions client/app/data/pacesetters.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ define([], function () {
'GENERIC_TABLE_ERR',
'SERVER_ERR',
'GENERIC_SUBMISSION_ERR',
'NAN_EMPTY_CELLS',
'SEMANTIC_CELLS',
'EMPTY_CELL',
'INVALID_CELL',
'CELL_ERROR'
]
}
Expand Down