diff --git a/utils/template.go b/utils/template.go index 84a18127..948aac32 100644 --- a/utils/template.go +++ b/utils/template.go @@ -54,13 +54,12 @@ func RenderTemplate(w http.ResponseWriter, context structs.PageContext, data int t := template.New("base.tmpl") t.Funcs(template.FuncMap{ "html": renderHTML, - "limitShowMeta": func(a []myradio.ShowMeta, start int, end int) []myradio.ShowMeta { - if len(a) < end { - return a[start:] - } else if len(a) < start { - return nil + //Takes a splice of show meta and returns the last x elements + "getLastShowMeta": func(a []myradio.ShowMeta, amount int) []myradio.ShowMeta { + if len(a) < amount { + return a } - return a[start:end] + return a[len(a)-amount:] }, //Takes a splice of seasons and returns the total number of episodes diff --git a/views/people.tmpl b/views/people.tmpl index 46370e99..f8b74d90 100644 --- a/views/people.tmpl +++ b/views/people.tmpl @@ -22,7 +22,7 @@

{{.Name}}


- {{range limitShowMeta .ShowCredits 0 6}} + {{range getLastShowMeta .ShowCredits 6}}
{{.Title}} logo.