Skip to content

Commit

Permalink
ENH: alert when sheet is completely valid
Browse files Browse the repository at this point in the history
Fixes #57.
  • Loading branch information
jairideout committed Jun 15, 2015
1 parent 63cef7e commit b5b60ca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features
* Valid cells (i.e., those without any errors or warnings) are no longer colored green as this information wasn't important to display. The green coloring could actually detract from the ease of locating invalid cells. [#58](https://github.com/biocore/Keemei/issues/58)
* Users are notified when a sheet is completely valid (i.e., no cells have errors or warnings) via a pop-up box. [#57](https://github.com/biocore/Keemei/issues/57)

## Version 2
Initial alpha release.
5 changes: 5 additions & 0 deletions src/Base.gs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ function validate() {
validateColumns_(sheet, state);

setStatus_(range, state);

if (isValidState_(state)) {
var ui = SpreadsheetApp.getUi();
ui.alert("Valid spreadsheet", "All's well! Your spreadsheet is valid.", ui.ButtonSet.OK);
}
};

function clear() {
Expand Down
14 changes: 14 additions & 0 deletions src/State.gs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ function setStatus_(range, state) {
range.setNotes(state.notes);
};

function isValidState_(state) {
var valid = true;
for (var i = 0; i < state.colors.length; i++) {
for (var j = 0; j < state.colors[i].length; j++) {
var color = state.colors[i][j];
if (color == Status.ERROR || color == Status.WARNING) {
valid = false;
break;
}
}
}
return valid;
};

function initializeState_(range) {
colors = initializeGrid_(range, Status.RESET);
notes = initializeGrid_(range, "");
Expand Down

0 comments on commit b5b60ca

Please sign in to comment.