Implement filter on tag click
This commit is contained in:
@@ -9,7 +9,11 @@ import (
|
||||
|
||||
func NewUUID() string {
|
||||
uuid := uuid.New().String()
|
||||
return Hash(uuid)
|
||||
}
|
||||
|
||||
func Hash(s string) string {
|
||||
h := fnv.New32a()
|
||||
h.Write([]byte(uuid))
|
||||
h.Write([]byte(s))
|
||||
return fmt.Sprint(h.Sum32())
|
||||
}
|
||||
|
||||
@@ -81,6 +81,10 @@ func (t *Task) MarshalJSON() ([]byte, error) {
|
||||
if t.Complete {
|
||||
compl = 1
|
||||
}
|
||||
tagsIds := make([]string, len(t.Tags))
|
||||
for i, tag := range t.Tags {
|
||||
tagsIds[i] = form.Hash(tag)
|
||||
}
|
||||
m := map[string]interface{}{
|
||||
"id": t.UUID,
|
||||
"title": t.Title,
|
||||
@@ -99,7 +103,7 @@ func (t *Task) MarshalJSON() ([]byte, error) {
|
||||
"noteText": strings.Join(t.Note, "\n"),
|
||||
"ow": 0,
|
||||
"tags": strings.Join([]string(t.Tags), ", "),
|
||||
"tags_ids": "",
|
||||
"tags_ids": strings.Join([]string(tagsIds), ", "),
|
||||
"duedate": t.Due.Format(fullFormat),
|
||||
"dueClass": "",
|
||||
"dueStr": t.Due.Format(shortFormat),
|
||||
|
||||
Reference in New Issue
Block a user