Skip to content

Commit

Permalink
finalize session
Browse files Browse the repository at this point in the history
  • Loading branch information
Dnouv committed Aug 11, 2024
1 parent e1f6e79 commit 7103cb0
Show file tree
Hide file tree
Showing 10 changed files with 696 additions and 89 deletions.
2 changes: 2 additions & 0 deletions app/pages/conferences/c/[eid].js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export async function getStaticProps(context) {
);
let prsession = sessionRes.data[0];

console.log('prsession', prsession.attributes);

if (!prsession) prsession = null;

return {
Expand Down
271 changes: 269 additions & 2 deletions cms/config/initialData/event-sessions.json

Large diffs are not rendered by default.

262 changes: 261 additions & 1 deletion cms/config/initialData/session.json

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions cms/config/initialData/top-nav-item.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"id": 14,
"label": "GSoC 2024 Alumni Summit",
"url": "/conferences/c/GSoC-Alumni-Summit-2024",
"style":"disable",
"published_at": "2021-06-21T09:03:49.991Z",
"created_at": "2021-06-21T09:03:57.289Z",
"updated_at": "2021-06-21T09:03:57.289Z"
Expand All @@ -43,6 +44,14 @@
"published_at": "2021-06-21T09:03:49.991Z",
"created_at": "2021-06-21T09:03:57.289Z",
"updated_at": "2021-06-21T09:03:57.289Z"
},
{
"id": 17,
"label": "GSoC 2024 Demo Day",
"url": "/conferences/c/GSoC-Demo-Day-2024",
"published_at": "2021-06-21T09:03:49.991Z",
"created_at": "2021-06-21T09:03:57.289Z",
"updated_at": "2021-06-21T09:03:57.289Z"
}
]
},
Expand Down
21 changes: 21 additions & 0 deletions data/date.py
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)
37 changes: 37 additions & 0 deletions data/increment.py
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.

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.

0 comments on commit 7103cb0

Please sign in to comment.