-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed it so we can just add time slots for each day then it will fill…
… the json properly
- Loading branch information
Showing
1 changed file
with
67 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |