From 7543c2c4cd9b100dcda0b5509c39c2568c4073f9 Mon Sep 17 00:00:00 2001 From: vilmibm Date: Thu, 23 Feb 2023 07:30:03 +0000 Subject: [PATCH] fixes --- cmd/review/main.go | 28 +++++++++++++++++----------- models/models.go | 6 ------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/review/main.go b/cmd/review/main.go index dcfacea..0924d14 100644 --- a/cmd/review/main.go +++ b/cmd/review/main.go @@ -60,18 +60,19 @@ func (r *reviewer) AddNote(s *models.TownSignup, content string) error { } func renderSignup(s models.TownSignup) string { - out := fmt.Sprintf("[-:-:b]submitted:[-:-:-] %s\n", s.Created.Format("2006-01-02 15:04")) + out := "" - pairs := map[string]string{ - "e-mail": s.Email, - "how found / referral": s.How, - "why like town / what do": s.Why, - "links": s.Links, + pairs := [][]string{ + {"submitted", s.Created.Format("2006-01-02 15:04")}, + {"e-mail", s.Email}, + {"how found / referral", s.How}, + {"why like town / plans", s.Why}, + {"links", s.Links}, } - for k, v := range pairs { - out += fmt.Sprintf("[-:-:b]%s[-:-:-]\n", k) - out += strings.TrimSpace(v) + for _, v := range pairs { + out += fmt.Sprintf("[-:-:b]%s[-:-:-]\n", v[0]) + out += strings.TrimSpace(v[1]) out += "\n\n" } @@ -148,12 +149,17 @@ func _main() error { count := tview.NewTextView() count.SetDynamicColors(true) updateCount := func() { - count.SetText(fmt.Sprintf("[-:-:b]%d pending signups[-:-:-]", len(signups))) + plural := "s" + if len(signups) == 1 { + plural = "" + } + count.SetText(fmt.Sprintf("[-:-:b]%d pending signup%s[-:-:-]", len(signups), plural)) } updateCount() notesView := tview.NewTextView() notesView.SetDynamicColors(true) + notesView.SetBorder(true).SetBorderColor(tcell.ColorPurple) bottomFlex := tview.NewFlex() bottomFlex.SetDirection(tview.FlexColumn) @@ -162,7 +168,7 @@ func _main() error { innerFlex := tview.NewFlex() innerFlex.SetDirection(tview.FlexColumn) - innerFlex.AddItem(appView, 0, 1, true) + innerFlex.AddItem(appView, 0, 2, true) innerFlex.AddItem(notesView, 0, 1, true) mainFlex := tview.NewFlex() diff --git a/models/models.go b/models/models.go index 9e89e96..3ea3c2b 100644 --- a/models/models.go +++ b/models/models.go @@ -158,12 +158,6 @@ func (s *TownSignup) All(db *sql.DB) ([]*TownSignup, error) { su.Created = time.Unix(timestamp, 0) - /* TODO do i need this? refreshing on render - if err = su.RefreshNotes(db); err != nil { - return nil, err - } - */ - out = append(out, su) }