mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-05 03:02:56 +00:00
dev day #79
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user