Skip to content

Commit

Permalink
Rename name to description for Difficulty
Browse files Browse the repository at this point in the history
  • Loading branch information
klaidliadon committed Dec 14, 2017
1 parent 5b88da1 commit 82acfdf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions component/cmp_difficulty.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
type Difficulty struct {
parent *Subcategory
ID string `json:"id"`
Name string `json:"name"`
Descr string `json:"description"`
Hash string `json:"hash"`
items []*Item
checklist *Checklist
Expand All @@ -19,7 +19,7 @@ func (d *Difficulty) Resource() Resource {
return Resource{
Slug: d.parent.Resource().Slug + "_" + d.ID,
Content: []map[string]string{
map[string]string{"name": d.Name},
map[string]string{"description": d.Descr},
},
}
}
Expand All @@ -37,10 +37,10 @@ func (d *Difficulty) Tree(html bool) interface{} {
}
}
return map[string]interface{}{
"id": d.ID,
"name": d.Name,
"items": items,
"checks": d.checklist.Checks,
"id": d.ID,
"description": d.Descr,
"items": items,
"checks": d.checklist.Checks,
}
}

Expand All @@ -54,9 +54,9 @@ func (d *Difficulty) SetParent(s *Subcategory) {

func (d *Difficulty) MarshalJSON() ([]byte, error) {
var m = map[string]interface{}{
"name": d.Name,
"items": d.ItemNames(),
"checks": d.checklist.Checks,
"description": d.Descr,
"items": d.ItemNames(),
"checks": d.checklist.Checks,
}
if d.Hash != "" {
m["hash"] = d.Hash
Expand Down Expand Up @@ -147,9 +147,9 @@ func (d *Difficulty) SetPath(filepath string) error {
return nil
}

func (d *Difficulty) order() []string { return []string{"Name"} }
func (d *Difficulty) pointers() args { return args{&d.Name} }
func (d *Difficulty) values() args { return args{d.Name} }
func (d *Difficulty) order() []string { return []string{"Description"} }
func (d *Difficulty) pointers() args { return args{&d.Descr} }
func (d *Difficulty) values() args { return args{d.Descr} }

func (d *Difficulty) Contents() string { return getMeta(d) }

Expand Down
4 changes: 2 additions & 2 deletions component/resource_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ func (r *ResourceParser) parseDifficulty(d *Difficulty, res *Resource, locale st
return fmt.Errorf("No sub %q (%s)", d.parent.ID, locale)
}
sub.AddDifficulty(&Difficulty{
ID: d.ID,
Name: res.Content[0]["name"],
ID: d.ID,
Descr: res.Content[0]["description"],
})
return nil
}
Expand Down

0 comments on commit 82acfdf

Please sign in to comment.