This commit is contained in:
Tomas Dvorak
2025-11-02 01:04:02 +01:00
parent ac886502e0
commit b9cea0cd77
153 changed files with 43713 additions and 1700 deletions
+25 -1
View File
@@ -54,7 +54,7 @@ func BuildNewsletterDigest(cacheDir string, prefs NewsletterPrefs) (subject stri
}
// Upcoming events
if want["events"] || want["matches"] {
if want["events"] {
items := pickUpcomingEvents(ev, 6)
if len(items) > 0 {
sections = append(sections, renderEventsSection(items))
@@ -140,6 +140,30 @@ func pickUpcomingEvents(v any, n int) []Event {
}
}
}
// Fallback URL to internal activity detail when not provided
if strings.TrimSpace(e.Url) == "" {
// Try to read numeric id from generic JSON number (float64)
if idv, ok := m["id"]; ok {
switch t := idv.(type) {
case float64:
if t > 0 {
e.Url = "/aktivita/" + fmt.Sprintf("%d", int64(t))
}
case int:
if t > 0 {
e.Url = "/aktivita/" + fmt.Sprintf("%d", t)
}
case int64:
if t > 0 {
e.Url = "/aktivita/" + fmt.Sprintf("%d", t)
}
case string:
if strings.TrimSpace(t) != "" {
e.Url = "/aktivita/" + strings.TrimSpace(t)
}
}
}
}
out = append(out, e)
}
return out