-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
97 lines (84 loc) · 3.55 KB
/
index.js
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
const functions = require("./lib.js")
const database = require("./database.js")
async function main() {
console.clear();
const delay = ms => new Promise(res => setTimeout(res, ms))
await functions.printProgramName()
await delay(2000)
await functions.printProgramDescription()
await delay(5000)
console.clear()
await database.getOracleCredentials()
await database.testOracleConnectivityAws()
await functions.login()
await delay(2000)
let time = functions.getCurrTime()
let needTime = 0
let day = functions.getCurrDay()
let roomType = 'CLASSROOM'
let needRepeat = true
let buildingLocs = await functions.getBuildingPos()
let buildingNames = await functions.getBuildingNames()
buildingLocs = functions.scanArray(buildingNames, buildingLocs)
let studentSchedule = await functions.getStudentSchedule()
console.clear()
let mainResponse = await functions.mainMenu()
while (mainResponse != 5) {
switch (mainResponse) {
case 0:
needRepeat = true
while (needRepeat) {
let buildingName = await functions.askUserBuilding(buildingLocs)
needTime = await functions.askUserNeedTime("How many minutes will you need the room?")
console.log("Retrieving data...")
console.log("This calculation may take a few moments...")
let buildingLocsRooms = await functions.getBuildingRoomSchedule(buildingName, buildingLocs)
buildingLocsRooms = await functions.getBusyTimes(buildingLocsRooms, buildingName)
let freeRoomArray = await functions.getFreeRooms(buildingLocsRooms, buildingName, day, time, roomType, needTime)
needRepeat = await functions.isEmpty(freeRoomArray, buildingName)
}
mainResponse = await functions.mainMenu()
break
case 1:
studentSchedule = await functions.checkOnlineClasses(studentSchedule, buildingLocs)
await delay(2000)
mainResponse = await functions.mainMenu()
break
case 2:
needRepeat = true
while(needRepeat) {
await functions.printStudSched()
studentSchedule = await functions.addDownTime(studentSchedule, buildingLocs)
needRepeat = await functions.confirm('Would you like to add more downtime to your schedule?')
}
mainResponse = await functions.mainMenu()
break
case 3:
console.clear()
await functions.printStudSched()
await delay(3000)
mainResponse = await functions.mainMenu()
break
case 4:
if (await functions.editOnlineClass()){
mainResponse = 1
break
}
console.clear()
await delay(1000)
mainResponse = await functions.mainMenu()
break
case 6:
if (await functions.editDownTime()){
mainResponse = 2
break
}
console.clear()
await delay(1000)
mainResponse = await functions.mainMenu()
break
}
}
console.log('Have a great day!')
}
main()