-
Notifications
You must be signed in to change notification settings - Fork 0
/
players.gs
52 lines (46 loc) · 1.58 KB
/
players.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
/**
* Returns Array of all players Abbv.
*
* @return {Array} an array of all players Abbv.
* @customfunction
*/
function getPlayersAbbvrList(abbvrColumnIndex) {
return getValuesForColumn('players', abbvrColumnIndex);
}
/**
* Returns Array of all players Names.
*
* @return {Array} an array of all players Names.
* @customfunction
*/
function getPlayersNamesList(namesColumnIndex) {
return getValuesForColumn('players', namesColumnIndex);
}
/**
* Returns Array of Objects of all players.
*
* @return {Array} an array of Objects of all players.
* @customfunction
*/
function getPlayersListAll(firstRowIndex, lastRowIndex, firstColumnIndex, lastColumnIndex) {
// var currentSheetName = SpreadsheetApp.getActiveSheet().getSheetName();
var arrayOfPlayers = rangeToListOfObjects('players', firstRowIndex, lastRowIndex, firstColumnIndex, lastColumnIndex);
return arrayOfPlayers;
}
/**
* Returns Array of Objects of players with status given as a param .
*
* @return {Array} an array of Objects of players with status given as a param.
* @customfunction
*/
function getPlayersListByStatus(firstRowIndex, lastRowIndex, firstColumnIndex, lastColumnIndex, status) {
// var sheetName = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getSheetName();
var arrayOfPlayers = rangeToListOfObjects('players', firstRowIndex, lastRowIndex, firstColumnIndex, lastColumnIndex);
var x = arrayOfPlayers.filter(function(element) {
return element.ref === status
});
return x.length;
}
function testGetPlayersListByStatus(){
Logger.log(getPlayersListByStatus(1,39,2,8,'L'));
}