Skip to content

Commit

Permalink
Fix KeyAuthors in Edition/Book API
Browse files Browse the repository at this point in the history
  • Loading branch information
zeddo123 committed Nov 27, 2021
1 parent 67db6eb commit 5df1758
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions editions.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func (b *Book) Load() {
}

// KeyAuthors returns array of all authors keys
func (b *Book) KeyAuthors() (keys []string, err error) {
func (b *Book) KeyAuthors() ([]string, error) {
if len(b.keyAuthors) > 0 {
return b.keyAuthors, err
return b.keyAuthors, nil
}
for _, child := range b.S("authors").Children() {
for _, v := range child.ChildrenMap() {
Expand All @@ -71,7 +71,7 @@ func (b *Book) KeyAuthors() (keys []string, err error) {
if len(b.keyAuthors) == 0 {
return b.keyAuthors, fmt.Errorf("Could not find any authors")
}
return
return b.keyAuthors, nil
}

//TODO: add this after dealing with authors API
Expand Down
5 changes: 5 additions & 0 deletions subjects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import (
)

func TestGetSubject(t *testing.T) {
//sub, err := gol.GetSubject("computer science")
//if err != nil {
//fmt.Println(err)
//}
//fmt.Println(sub)
}

func TestGetSubjectDetails(t *testing.T) {
Expand Down

0 comments on commit 5df1758

Please sign in to comment.