Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions events/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def parse_form_data(form_data: ImmutableMultiDict) -> dict | str:
return error

# prefer text_colour if both are provided (in case these colours change)
colour = text_colour if text_colour else color_colour
colour = text_colour or color_colour

# parse start and end times
start_times = [get_datetime_from_string(t) for t in form_data.getlist("start_time[]")]
Expand Down Expand Up @@ -339,9 +339,7 @@ def get_calendar(events: list[Event]) -> Calendar:
ical_event.add("location", event.location)
ical_event.add("uid", f"{event.id}@uwcs-fulcrum")
ical_event.add("dtstart", event.start_time)
ical_event.add(
"dtend", event.end_time if event.end_time else event.start_time + timedelta(hours=1)
)
ical_event.add("dtend", event.end_time or event.start_time + timedelta(hours=1))
ical_event.add("dtstamp", datetime.now(timezone("Europe/London")))
ical_event.add(
"url",
Expand Down
15 changes: 13 additions & 2 deletions exec/publicity.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,19 @@ def create_multi_week(
) / NUM_WEEKS
week_width = term_width

# merge weekends into one day
for week in events[0]["terms"][0]["weeks"]:
days = week["days"]
weekend_events = []
for day in days:
if day["day"] in ["Saturday", "Sunday"]:
weekend_events.extend(day["events"])
# remove saturday and sunday, add weekend
week["days"] = [day for day in days if day["day"] not in ["Saturday", "Sunday"]]
week["days"].append({"day": "Weekend", "events": weekend_events})

# add week days
day_names = ["MON", "TUE", "WED", "THU", "FRI", "SAT"]
day_names = ["MON", "TUE", "WED", "THU", "FRI", "WEEKEND"]
day_size = week_height * TERM_DAY_SIZE
day_names_base = term_left + WEEK_NUM_WIDTH * term_width + day_size / 2
for i, day in enumerate(day_names):
Expand All @@ -762,7 +773,7 @@ def create_multi_week(
)

# add week events
day_names = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
day_names = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Weekend"]
week_base = term_top + TERM_DAY_TEXT_HEIGHT + TERM_WEEK_PADDING * term_height
text_base = week_base + week_height / 2
for i, week in enumerate(events[0]["terms"][0]["weeks"]):
Expand Down
2 changes: 1 addition & 1 deletion schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__( # noqa: PLR0913
self.location = location
self.location_url = location_url
self.icon = icon
self.colour = colour if colour else "blue"
self.colour = colour or "blue"
self.start_time = start_time
self.end_time = end_time
self._localise_times()
Expand Down
2 changes: 1 addition & 1 deletion scripts/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def parse_event(path: Path, repeat: bool) -> dict:
event.update(event.pop("taxonomies", {}))

# add description
event["description"] = parts[2].strip() if parts[2].strip() else event["title"]
event["description"] = parts[2].strip() or event["title"]

if not repeat:
# parse start time
Expand Down