fic: Tag now in Title format
Signed-off-by: MCharpy <mahe.charpy@epita.fr>
This commit is contained in:
parent
56d8d49304
commit
2e4513c00f
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user