-
Notifications
You must be signed in to change notification settings - Fork 0
/
Run.gs
79 lines (69 loc) · 2.59 KB
/
Run.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//globals
var dutyNo = 0;
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var memberArray = spreadsheet.getSheetByName('Members').getRange(2, 1, spreadsheet.getSheetByName('Members').getLastRow() - 1, 3).getValues();
var dutySetupArray = [];
var memberDutyArray = [];
var awayDateArray = [];
var dutyArray = [];
var dutyConstraintArray = [];
var constraintSetupArray = [];
function insertDuties() {
clearDuties();
dutySetupArray = readArrayFromSheet('Duty Setup');
populateDuties();
}
function insertAwayDates() {
populateAwayDateData();
writeArrayToSheet(awayDateArray,'Away Date Data');
}
function insertAwayDateContraints() {
dutySetupArray = readArrayFromSheet('Duty Setup');
dutyArray = readArrayFromSheet('Duties');
populateMemberDutyArray();
awayDateArray = readArrayFromSheet('Away Date Data');
populateConstraintsForAwayDates();
writeArrayToSheet(dutyConstraintArray,'Duty Constraint');
}
function updateDutyConstraints() {
dutySetupArray = readArrayFromSheet('Duty Setup');
dutyArray = readArrayFromSheet('Duties');
dutyConstraintArray = readArrayFromSheet('Duty Constraint');
populateMemberDutyArray();
constraintSetupArray = readArrayFromSheet('Constraint Setup');
plannedDuties = getPlannedDuties();
plannedDuties.forEach(function(element){updateConstraintsForDuty(element[0])});
writeArrayToSheet(dutyConstraintArray,'Duty Constraint');
}
function updateCandidatesForDuties2() {
dutySetupArray = readArrayFromSheet('Duty Setup');
dutyArray = readArrayFromSheet('Duties');
dutyConstraintArray = readArrayFromSheet('Duty Constraint');
populateMemberDutyArray();
updateCandidatesForDuties();
writeArrayToSheet(dutyArray,'Duties');
}
function calculatePlan() {
dutySetupArray = readArrayFromSheet('Duty Setup');
dutyArray = readArrayFromSheet('Duties');
dutyConstraintArray = readArrayFromSheet('Duty Constraint');
populateMemberDutyArray();
awayDateArray = readArrayFromSheet('Away Date Data');
constraintSetupArray = readArrayFromSheet('Constraint Setup');
planDuties();
writeArrayToSheet(dutyConstraintArray,'Duty Constraint');
writeArrayToSheet(dutyArray,'Duties');
}
function awayDateSummary() {
awayDateArray = readArrayFromSheet('Away Date Data');
writeAwayDateSummary();
}
function test() {
dutySetupArray = readArrayFromSheet('Duty Setup');
dutyArray = readArrayFromSheet('Duties');
dutyConstraintArray = readArrayFromSheet('Duty Constraint');
populateMemberDutyArray();
constraintSetupArray = readArrayFromSheet('Constraint Setup');
updateConstraintsForDuty(367);
writeArrayToSheet(dutyConstraintArray,'Duty Constraint');
}