nest tags because i wanna add mastered tags later
This commit is contained in:
1
testdata/tofugu.yaml
vendored
1
testdata/tofugu.yaml
vendored
@@ -8,6 +8,7 @@ knowledge:
|
|||||||
users:
|
users:
|
||||||
breel:
|
breel:
|
||||||
tags:
|
tags:
|
||||||
|
assignments:
|
||||||
- hiragana
|
- hiragana
|
||||||
- katakana
|
- katakana
|
||||||
history: {}
|
history: {}
|
||||||
|
|||||||
@@ -19,9 +19,12 @@ type (
|
|||||||
Answers map[string]Answer
|
Answers map[string]Answer
|
||||||
}
|
}
|
||||||
user struct {
|
user struct {
|
||||||
Tags []string
|
Tags tags
|
||||||
History map[string][]History
|
History map[string][]History
|
||||||
}
|
}
|
||||||
|
tags struct {
|
||||||
|
Assignments []string
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func newYamlDB(p string) (yamlDB, error) {
|
func newYamlDB(p string) (yamlDB, error) {
|
||||||
@@ -46,7 +49,7 @@ func (db yamlDB) HistoryOf(user string) map[string][]History {
|
|||||||
for k, v := range db.Users[user].History {
|
for k, v := range db.Users[user].History {
|
||||||
result[k] = append([]History{}, v...)
|
result[k] = append([]History{}, v...)
|
||||||
}
|
}
|
||||||
for _, tag := range db.Users[user].Tags {
|
for _, tag := range db.Users[user].Tags.Assignments {
|
||||||
for qid, q := range db.Knowledge.Questions {
|
for qid, q := range db.Knowledge.Questions {
|
||||||
if _, ok := result[qid]; !ok && q.Tagged(tag) {
|
if _, ok := result[qid]; !ok && q.Tagged(tag) {
|
||||||
result[qid] = []History{}
|
result[qid] = []History{}
|
||||||
|
|||||||
Reference in New Issue
Block a user