Skip to content

Commit

Permalink
fix(cl-events): filter empty string descriptions and improve logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert27 committed Dec 1, 2024
1 parent f22b9ca commit b102f1d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/scraping/cl-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ async function getEventDetails(
.replace(/( \.)$/g, '')
.replace(/e\. V\./g, 'e.V.')
const trimmedEvent = details.Event.trim()
const trimmedDescription =
publicEvent &&
details.Beschreibung != null &&
details.Beschreibung !== ''
? details.Beschreibung.trim()
: null

return {
id: xxh64(`${trimmedOrganizer}-${trimmedEvent}`, 123n).toString(16),
Expand All @@ -252,15 +258,12 @@ async function getEventDetails(
end: details.Ende ? parseLocalDateTime(details.Ende) : null,
endDateTime: details.Ende ? parseLocalDateTime(details.Ende) : null,
location: publicEvent ? details.Ort : null,
description:
publicEvent && details.Beschreibung != null
? details.Beschreibung
: null,
description: trimmedDescription,
descriptions:
publicEvent && details.Beschreibung != null
trimmedDescription != null
? {
de: details.Beschreibung,
en: details.Beschreibung,
de: trimmedDescription,
en: trimmedDescription,
}
: null,
eventWebsite: null, // not available in Moodle
Expand Down

0 comments on commit b102f1d

Please sign in to comment.