refactor(discovery/crawler): hoist land constants; document Tribe date format assumption
This commit is contained in:
11
backend/internal/domain/discovery/crawler/constants.go
Normal file
11
backend/internal/domain/discovery/crawler/constants.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package crawler
|
||||
|
||||
// Land names used in RawEvent/MergedEvent.Land and throughout discovery. ASCII
|
||||
// forms (Oesterreich, not Österreich) to keep string comparisons and log output
|
||||
// stable across locales. Defined in one place so every source parser references
|
||||
// the same constants.
|
||||
const (
|
||||
landDeutschland = "Deutschland"
|
||||
landOesterreich = "Oesterreich"
|
||||
landSchweiz = "Schweiz"
|
||||
)
|
||||
@@ -10,12 +10,6 @@ import (
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
)
|
||||
|
||||
const (
|
||||
landDeutschland = "Deutschland"
|
||||
landOesterreich = "Oesterreich"
|
||||
landSchweiz = "Schweiz"
|
||||
)
|
||||
|
||||
// MarktkalendariumSource scrapes www.marktkalendarium.de. Table rows:
|
||||
// Von | Bis | Veranstaltung | Ort | Platz | Webseite | Veranstalter
|
||||
type MarktkalendariumSource struct {
|
||||
|
||||
@@ -168,7 +168,14 @@ func tribeCountryToLand(country string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// parseTribeDate parses the Tribe Events date format "YYYY-MM-DD HH:MM:SS" (local time).
|
||||
// parseTribeDate parses the Tribe Events JSON date format
|
||||
// "YYYY-MM-DD HH:MM:SS" in the site's local time. If the site ever switches
|
||||
// to ISO-8601 with T-separator or an explicit timezone, this function will
|
||||
// start returning errors and events will be silently dropped. The symptom
|
||||
// will show up as "eventsFetched > 0 but Discovered = 0" in CrawlSummary —
|
||||
// at that point switch to the iCal endpoint at
|
||||
// https://mittelaltermarkt.online/events/?ical=1 which uses the standard
|
||||
// VEVENT DTSTART format and is more durable across plugin upgrades.
|
||||
func parseTribeDate(s string) (*time.Time, error) {
|
||||
s = strings.TrimSpace(s)
|
||||
if s == "" {
|
||||
|
||||
Reference in New Issue
Block a user