From 2e4513c00fb99399819f3c92fedb593e5f87f24b Mon Sep 17 00:00:00 2001 From: MCharpy Date: Sun, 5 Sep 2021 19:53:58 +0200 Subject: [PATCH] fic: Tag now in Title format Signed-off-by: MCharpy --- libfic/exercice_tag.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libfic/exercice_tag.go b/libfic/exercice_tag.go index 22c4088b..860dd1d4 100644 --- a/libfic/exercice_tag.go +++ b/libfic/exercice_tag.go @@ -1,5 +1,9 @@ package fic +import ( + "strings" +) + // GetTags returns tags associated with this exercice. func (e Exercice) GetTags() (tags []string, err error) { if rows, errr := DBQuery("SELECT tag FROM exercice_tags WHERE id_exercice = ?", e.Id); errr != nil { @@ -22,6 +26,7 @@ func (e Exercice) GetTags() (tags []string, err error) { // AddTag assign a new tag to the exercice and registers it into the database. func (e Exercice) AddTag(tag string) (string, error) { + tag = strings.Title(tag) if _, err := DBExec("INSERT INTO exercice_tags (id_exercice, tag) VALUES (?, ?)", e.Id, tag); err != nil { return "", err } else {