Skip to content

Commit

Permalink
Minor events fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelmdLow committed Sep 12, 2024
1 parent b791ec8 commit a326ba0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
29 changes: 16 additions & 13 deletions events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,13 +615,19 @@ async def cs_ubc_create_event(self, ical_component):
if event.hash == "":
event.hash = self.hashing(ical_component.get('summary') + str(ical_component.decoded('dtstart')))

event.description= "<br>" + ical_component.get('description').replace("&amp;", "&")
if "<br>Name:" in event.description and "\nTitle" in event.description:
if event.description.index("<br>Name:") < event.description.index("\nTitle"):
event.description = event.description.replace(event.description[event.description.index("<br>Name:"):event.description.index("\nTitle")], "")
if "\nName:" in event.description and "\nTitle" in event.description:
if event.description.index("\nName:") < event.description.index("\nTitle"):
event.description = event.description.replace(event.description[event.description.index("\nName:"):event.description.index("\nTitle")], "")
if ical_component.get('description', False):
event.description= "<br>" + ical_component.get('description').replace("&amp;", "&")
if "<br>Name:" in event.description and "\nTitle" in event.description:
if event.description.index("<br>Name:") < event.description.index("\nTitle"):
event.description = event.description.replace(event.description[event.description.index("<br>Name:"):event.description.index("\nTitle")], "")
if "\nName:" in event.description and "\nTitle" in event.description:
if event.description.index("\nName:") < event.description.index("\nTitle"):
event.description = event.description.replace(event.description[event.description.index("\nName:"):event.description.index("\nTitle")], "")

if "Location: " in ical_component.get('description'):
s = ical_component.get('description')[ical_component.get('description').index("Location: ") + len("Location: "):]
event.location = s[:s.index("\n")]


if isinstance(ical_component.decoded('dtstart'), datetime):
event.start_time=ical_component.decoded('dtstart').astimezone(timezone.get_current_timezone())
Expand All @@ -632,12 +638,9 @@ async def cs_ubc_create_event(self, ical_component):
event.end_time=ical_component.decoded('dtend').astimezone(timezone.get_current_timezone())
else:
event.end_time=datetime.combine(ical_component.decoded('dtend'), time(), tzinfo=timezone.get_current_timezone())

event.location = ical_component.get('location')

if "Location: " in ical_component.get('description'):
s = ical_component.get('description')[ical_component.get('description').index("Location: ") + len("Location: "):]
event.location = s[:s.index("\n")]

if ical_component.get('location', False):
event.location = ical_component.get('location')

event.event_url = ical_component.get("url")
event.email=""
Expand Down
5 changes: 4 additions & 1 deletion ubyssey/static_src/src/js/components/Events/calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,10 @@ function EventsCalendar({events}) {
<ul>{legend.map((key, i) =>
<li key={i} className={slugify(key)}>
<button id={slugify(key)} className={"legend-button" + (hidden.includes(slugify(key)) ? " inactive" : "")}
onClick={(e) => toggleCategory(e.target, searchParams, setSearchParams)} title={key}>{key}</button>
onClick={(e) => toggleCategory(e.target, searchParams, setSearchParams)} title={key}
dangerouslySetInnerHTML={
{__html: key}
}></button>
</li>
)}</ul>
</div>
Expand Down

0 comments on commit a326ba0

Please sign in to comment.