From 2a45fd770747d0f61fc3dac898f09af59d836505 Mon Sep 17 00:00:00 2001 From: Bogdan Brinza Date: Thu, 27 Jul 2023 21:15:51 -0700 Subject: [PATCH] Shortening updates group titles --- go.mod | 2 +- rest/get_updates.go | 25 ++++++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e93aaaa..9cf3db9 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/arelate/gaugin -go 1.19 +go 1.20 require ( github.com/arelate/southern_light v0.1.28 diff --git a/rest/get_updates.go b/rest/get_updates.go index 94f6933..5b58de5 100644 --- a/rest/get_updates.go +++ b/rest/get_updates.go @@ -57,9 +57,6 @@ func GetUpdates(w http.ResponseWriter, r *http.Request) { } updates[section] = append(updates[section], id) } - //if len(ids) > 0 { - // updates[section] = ids - //} } keys := make(map[string]bool) @@ -118,14 +115,32 @@ func GetUpdates(w http.ResponseWriter, r *http.Request) { gaugin_middleware.DefaultHeaders(st, w) + // section order will be based on full title ("new in ...", "updates in ...") + // so not changed after concise update titles change sections := maps.Keys(updates) sort.Strings(sections) - var caser = cases.Title(language.Russian) + var caser = cases.Title(language.English) sectionTitles := make(map[string]string) for t, _ := range updates { - sectionTitles[t] = caser.String(t) + st := t + switch t { + case "new in store": + st = "store" + case "new in account": + st = "account" + case "new in wishlist": + st = "wishlist" + case "released today": + st = "today" + case "updates in account": + st = "updates" + case "updates in news": + st = "news" + } + + sectionTitles[t] = caser.String(st) } if err := app.RenderGroup(