Skip to content

Commit

Permalink
fixed it so we can just add time slots for each day then it will fill…
Browse files Browse the repository at this point in the history
… the json properly
  • Loading branch information
alexvillr committed Oct 25, 2023
1 parent 15c5d54 commit 8fac678
Showing 1 changed file with 67 additions and 10 deletions.
77 changes: 67 additions & 10 deletions vision/make_availabilities.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,77 @@
import json
import os

from constants import days_of_the_week

users = ['Timmy', 'Kimmy', 'Jimmy', 'Timmy_Jr']
time_slots = [0, 1, 2, 3, 4, 5, 6, 7]
default = []
users = {
'Timmy': [],
'Kimmy': [],
'Jimmy': [],
'Timmy_Jr': [],
}
timmy_time_slots = {
'monday': [0, 1, 2, 3, 4, 5, 6, 7],
'tuesday': [0, 1, 2, 3, 4, 5, 6, 7],
'wednesday': [0, 1, 2, 3, 4, 5, 6, 7],
'thursday': [0, 1, 2, 3, 4, 5, 6, 7],
'friday': [0, 1, 2, 3, 4, 5, 6, 7],
'saturday': [0, 1, 2, 3, 4, 5, 6, 7],
'sunday': [0, 1, 2, 3, 4, 5, 6, 7],
}
timmj_time_slots = {
'monday': [0, 1, 2, 3, 4, 5, 6, 7],
'tuesday': [0, 1, 2, 3, 4, 5, 6, 7],
'wednesday': [0, 1, 2, 3, 4, 5, 6, 7],
'thursday': [0, 1, 2, 3, 4, 5, 6, 7],
'friday': [0, 1, 2, 3, 4, 5, 6, 7],
'saturday': [0, 1, 2, 3, 4, 5, 6, 7],
'sunday': [0, 1, 2, 3, 4, 5, 6, 7],
}
jimmy_time_slots = {
'monday': [0, 1, 2, 3, 4, 5, 6, 7],
'tuesday': [0, 1, 2, 3, 4, 5, 6, 7],
'wednesday': [0, 1, 2, 3, 4, 5, 6, 7],
'thursday': [0, 1, 2, 3, 4, 5, 6, 7],
'friday': [0, 1, 2, 3, 4, 5, 6, 7],
'saturday': [0, 1, 2, 3, 4, 5, 6, 7],
'sunday': [0, 1, 2, 3, 4, 5, 6, 7],
}
kimmy_time_slots = {
'monday': [0, 1, 2, 3, 4, 5, 6, 7],
'tuesday': [0, 1, 2, 3, 4, 5, 6, 7],
'wednesday': [0, 1, 2, 3, 4, 5, 6, 7],
'thursday': [0, 1, 2, 3, 4, 5, 6, 7],
'friday': [0, 1, 2, 3, 4, 5, 6, 7],
'saturday': [0, 1, 2, 3, 4, 5, 6, 7],
'sunday': [0, 1, 2, 3, 4, 5, 6, 7],
}


def make_json(person):
result = []
for day in person:
for time in day:
result.append(
{'day': day, 'time_slot': time, 'data': '', 'colour': 'black'}
)

return result


for time_slots in make_json(timmy_time_slots):
users.get('Timmy').append(time_slots)

for time_slots in make_json(timmj_time_slots):
users.get('Timmy_Jr').append(time_slots)

for time_slots in make_json(kimmy_time_slots):
users.get('Kimmy').append(time_slots)

for time_slots in make_json(jimmy_time_slots):
users.get('Jimmy').append(time_slots)

for day in days_of_the_week:
for time_slot in time_slots:
default.append(
{'day': day, 'time_slot': time_slot, 'data': '', 'colour': 'black'}
)

for user in users:
path = os.path.abspath(f'./premade/{user}.json')
print(path)
with open(path, 'w') as file:
json.dump(default, file, indent=4)
json.dump(users.get(user), file, indent=4)

0 comments on commit 8fac678

Please sign in to comment.