Skip to content

Commit

Permalink
fix: parseRelatives
Browse files Browse the repository at this point in the history
  • Loading branch information
renato-macedo committed May 19, 2020
1 parent 79924aa commit 1a1a752
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions character/service.go
Expand Up @@ -103,7 +103,16 @@ func (service *Service) Delete(id string) error {
}

func parseRelatives(relativesResult string) int {
// TODO handle edge cases
relatives := strings.Split(relativesResult, "),")
return len(relatives)
if relativesResult == "-" {
return 0
}
counter := 0

firstLv := strings.Split(relativesResult, ";")

for _, val := range firstLv {
counter += len(strings.Split(val, "), "))
}

return counter
}

0 comments on commit 1a1a752

Please sign in to comment.