diff --git a/cmd/getAvailableModules.go b/cmd/getAvailableModules.go index ef4b784..37ae3fb 100644 --- a/cmd/getAvailableModules.go +++ b/cmd/getAvailableModules.go @@ -88,7 +88,9 @@ func isEvent(eventSelection *goquery.Selection) bool { func extractEvent(eventSelection *goquery.Selection) (Event, error) { paragraphs := eventSelection.Find("p") - id := paragraphs.Find("a[name='eventLink']").Text()[0:6] + regexForId := regexp.MustCompile("\\d{2}-\\d{3}\\w?") + idText := paragraphs.Find("a[name='eventLink']").Text() + id := regexForId.FindStringSubmatch(idText)[0] title := paragraphs.Find(".eventTitle").Text() // something unnecessary whitespace is added in the title at the start or end, remove diff --git a/cmd/getAvailableModules_test.go b/cmd/getAvailableModules_test.go index 62f1b5e..0adb88f 100644 --- a/cmd/getAvailableModules_test.go +++ b/cmd/getAvailableModules_test.go @@ -238,7 +238,7 @@ func TestGetAvailableModules(t *testing.T) { -

64-091 Exercises Distributed Systems and Systems Security

+

64-091a Exercises Distributed Systems and Systems Security

Markus Ruehl

@@ -344,7 +344,7 @@ func TestGetAvailableModules(t *testing.T) { RegistrationLink: "", // should be empty, as simulated user is already registered Events: []Event{ { - Id: "64-091", + Id: "64-091a", Title: "Exercises Distributed Systems and Systems Security", Link: stineURL.Url + "/scripts/cfefef3", MaxCapacity: math.Inf(1),