-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmeal.py
More file actions
40 lines (30 loc) · 1.13 KB
/
Copy pathmeal.py
File metadata and controls
40 lines (30 loc) · 1.13 KB
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
class Meal:
def __init__(self, name, startTimeLimit, endTimeLimit, duration):
self.name = name
self.possibleIntervals = self.createPossibleIntervals(startTimeLimit, endTimeLimit)
self.duration = int(int(duration) / 15)
def createPossibleIntervals(self, startTimeLimit, endTimeLimit):
interval = 15
startTimeLimit = startTimeLimit.split(':')
endTimeLimit = endTimeLimit.split(':')
possibleIntervals = []
hour = int(startTimeLimit[0])
minute = int(startTimeLimit[1])
# iterator = 0
while hour < int(endTimeLimit[0]):
# iterator = 0
while minute < 60:
possibleIntervals.append((hour, minute))
minute += interval
# iterator += 1
if (minute > 60):
minute = 15
else:
minute = 0
hour += 1
# iterator = 0
while minute < int(endTimeLimit[1]):
possibleIntervals.append((hour, minute))
minute += interval
# iterator += 1
return possibleIntervals