-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarchingBandCategory.gs
55 lines (48 loc) · 1.69 KB
/
MarchingBandCategory.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var Model = Model || {};
/**
* Constructs a new category specifically for categories for Marching Band.
*
* @param {String} categoryName
* The category name, used when identifying the category and even creating a spreadsheet
* for it.
* @constructor
*/
Model.MarchingBandCategory = function (categoryName) {
/**
* Determines whether or not the current entry matches the specified value.
*
* @param {String[]} headers
* The headers, which will help to associate the values in the rowToMatch parameter with the
* meaning of the values. Basically, the 0th value in the headers would match the 0th value
* in the rowToMatch.
* @param rowToMatch
* The row that the current match is being performed on. This value and the corresponding
* header should be checked to determined if the value matches.
*
* @return {boolean} true if the entry in the rowToMatch parameter should be included in this
* category, false otherwise.
*/
this.matches = function (headers, rowToMatch) {
var bandIndex = headers.indexOf('Band');
// sanity check, if the index is missing, we just indicate that it is not a match.
if (bandIndex === -1) {
return false;
}
var bandValue = rowToMatch[bandIndex];
return bandValue === 'yes';
};
/**
* The category name, used when identifying the category and even creating a spreadsheet
* for it.
*
* @type {String}
*/
this.categoryName = categoryName;
/**
* The spreadsheet associated to this category. This value might not be initialized and should
* be accessed defensively.
*
* @type {null|GoogleAppsScript.Spreadsheet.Spreadsheet}
*/
this.spreadsheet = null;
};