Oh, oops. range copies values, that's why nothing happens. Use good old for now.
This commit is contained in:
parent
1e7819e1aa
commit
80d618347e
@ -76,6 +76,12 @@ func (h *RadioHandlers) Index(w http.ResponseWriter, r *http.Request) {
|
|||||||
status.ServerStartISO8601 = utils.ToClientTimezone(tim, r).Format(FormatISO8601)
|
status.ServerStartISO8601 = utils.ToClientTimezone(tim, r).Format(FormatISO8601)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(songs); i++ {
|
||||||
|
if tim, err := time.Parse("15:04-0700", songs[i].Time); err == nil {
|
||||||
|
songs[i].Time = utils.ToClientTimezone(tim, r).Format("15:04")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := compiledTemplates["index"].Execute(w, &IndexData{
|
if err := compiledTemplates["index"].Execute(w, &IndexData{
|
||||||
MainSite: utils.MainSite(r.Host),
|
MainSite: utils.MainSite(r.Host),
|
||||||
Status: status,
|
Status: status,
|
||||||
@ -117,13 +123,8 @@ func (h *RadioHandlers) LastSong(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, song := range songs {
|
if tim, err := time.Parse("15:04-0700", songs[0].Time); err == nil {
|
||||||
tim, err := time.Parse("15:04-0700", song.Time)
|
songs[0].Time = utils.ToClientTimezone(tim, r).Format("15:04")
|
||||||
if err == nil {
|
|
||||||
song.Time = utils.ToClientTimezone(tim, r).Format("15:04")
|
|
||||||
} else {
|
|
||||||
h.logErr.Println("song time parse error:", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
|
Loading…
Reference in New Issue
Block a user