-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
696 additions
and
89 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import json | ||
from datetime import datetime, timedelta | ||
|
||
# Read the JSON file | ||
with open('session_sorted.json', 'r') as file: | ||
sessions = json.load(file) | ||
|
||
# Initialize the start date | ||
start_date = datetime(2024, 9, 1, 6, 0, 0) | ||
|
||
# Iterate through each session and update the "Start" and "End" dates | ||
for session in sessions: | ||
duration = session['Duration'] | ||
session['Start'] = start_date.isoformat() + 'Z' | ||
end_date = start_date + timedelta(minutes=duration) | ||
session['End'] = end_date.isoformat() + 'Z' | ||
start_date = end_date # Update start_date for the next session | ||
|
||
# Save the updated JSON data back to the file | ||
with open('session_sorted.json', 'w') as file: | ||
json.dump(sessions, file, indent=4) |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import json | ||
|
||
# Define the increment value | ||
increment_value = 9 | ||
|
||
# Read the JSON file | ||
with open('session_sorted.json', 'r') as file: | ||
data = json.load(file) | ||
|
||
# Function to recursively update event_id in the JSON data | ||
def update_event_id(obj, increment): | ||
if isinstance(obj, dict): | ||
for key, value in obj.items(): | ||
if key == 'id': | ||
try: | ||
# Try to convert the value to an integer | ||
int_value = int(value) | ||
# Increment the value | ||
int_value += increment | ||
# Convert it back to string if it was originally a string | ||
obj[key] = str(int_value) if isinstance(value, str) else int_value | ||
print(f"Updated event_id to {obj[key]}") # Debugging line | ||
except ValueError: | ||
# If conversion fails, skip this value | ||
pass | ||
else: | ||
update_event_id(value, increment) | ||
elif isinstance(obj, list): | ||
for item in obj: | ||
update_event_id(item, increment) | ||
|
||
# Update the event_id values | ||
update_event_id(data, increment_value) | ||
|
||
# Write the updated JSON back to the file | ||
with open('session_sorted.json', 'w') as file: | ||
json.dump(data, file, indent=4) |
File renamed without changes.
183 changes: 97 additions & 86 deletions
183
...ents/conferences/data/session_sorted.json → data/session_sorted.json
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.