-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_up.gs
125 lines (86 loc) · 3.21 KB
/
clean_up.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var currentsheet = SpreadsheetApp.getActiveSpreadsheet()
function findClosed(theLevel) {
Logger.log(' --------- This ran ' + theLevel)
var theLookUp = "Level " + theLevel
var thesheet1 = currentsheet.getSheetByName(theLookUp)
var theLastRow = thesheet1.getRange('I1:I').getLastRow() - 1
var checkTrue = 0
var run_value = 2
while (run_value <= theLastRow) {
Logger.log('LEVEL ' + theLevel + ' === > ' + thesheet1.getRange('I' + run_value).getValue())
if (thesheet1.getRange('I' + run_value).getValue() != 'LEVEL ' + theLevel && thesheet1.getRange('B'+run_value).getValue() == 'In use') {
checkTrue++
Logger.log(run_value + ' <run value> ' + thesheet1.getRange('I' + run_value).getValue() + ' ' + checkTrue)
}
if (thesheet1.getRange('I' + run_value).getValue() == 'SENT FOR GRAD') {
checkTrue++
}
if (thesheet1.getRange('I' + run_value).getValue() == 'TESTING') {
checkTrue++
}
if (checkTrue > 0) {
removeCompleted(thesheet1.getRange('A'+run_value).getValue())
thesheet1.getRange('A'+run_value).setValue('X')
thesheet1.getRange('B'+run_value).setValue('Out')
doNotAssignThisWeek(thesheet1.getRange('F'+run_value).getValue())
thesheet1.getRange('F'+run_value).clearContent()
thesheet1.getRange('G'+run_value).clearContent()
thesheet1.getRange('H'+run_value).clearContent()
}
checkTrue = 0
run_value++;
}
}
function testingThis() {
var theLookUp = "Level 1"
var thesheet1 = currentsheet.getSheetByName(theLookUp)
var theLastRow = thesheet1.getRange('C1:C').getLastRow() - 1
var i_values = thesheet1.getRange('C1:c' + theLastRow).getValues()
var run_value = 1
//var array_col = []
//var ref_col = 0
Logger.log(theLastRow)
while(run_value < theLastRow) {
Logger.log(i_values[run_value][0] + "// " + run_value)
run_value++
}
}
function checkouts() {
try {
findClosed(1)
findClosed(2)
findClosed(3)
findClosed(4)
} catch(err) {
MailApp.sendEmail("160calories@gmail.com","Error in running function.","Submitting error.")
}
}
function doNotAssignThisWeek(freed_sensei) {
SpreadsheetApp.flush()
var instertToSheet = currentsheet.getSheetByName('Assign Area')
var theStartPoint = '17'
while(instertToSheet.getRange('G' + theStartPoint).getValue() != '') {
theStartPoint++
}
instertToSheet.getRange('G' + theStartPoint).setValue(freed_sensei)
instertToSheet.getRange('H' + theStartPoint).setValue('0')
}
function updateHoldDate() {
var instertToSheet = currentsheet.getSheetByName('Assign Area')
var lastCellToReview = 32
var theCurrentCell
instertToSheet.getRange('G17:H'+lastCellToReview).sort({column: 8,ascending: false});
for (i = 17; i <= lastCellToReview; i++) {
if(instertToSheet.getRange('G'+i).getValue() == '') {
continue;
}
if(instertToSheet.getRange('H'+i).getValue() == 3) {
instertToSheet.getRange('G' + i + ':H'+i).clearContent()
continue;
}
theCurrentCell = instertToSheet.getRange('H'+i).getValue()
theCurrentCell++
instertToSheet.getRange('H'+i).setValue(theCurrentCell)
}
instertToSheet.getRange('G17:H' + lastCellToReview).sort({column: 8,ascending: false});
}