Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
alaingilbert committed Oct 1, 2022
1 parent b06481e commit 19e1f4f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pkg/extractor/v9/extracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,21 +739,16 @@ func extractTechnologyDetailsFromDoc(doc *goquery.Document) (out ogame.Technolog
out.Price.Deuterium = utils.DoParseI64(doc.Find("div.costs li.deuterium").AttrOr("data-value", ""))
out.Price.Population = utils.DoParseI64(doc.Find("div.costs li.population").AttrOr("data-value", ""))

if doc.Find("button.downgrade").Length() == 1 {
if _, exists := doc.Find("button.downgrade").Attr("disabled"); !exists {
out.TearDownEnabled = true
}
}
out.TearDownEnabled = extractTearDownButtonEnabledFromDoc(doc)

return out, err
}

func extractTearDownButtonEnabledFromDoc(doc *goquery.Document) bool {
var tearDownEnabled bool
func extractTearDownButtonEnabledFromDoc(doc *goquery.Document) (out bool) {
if doc.Find("button.downgrade").Length() == 1 {
if _, exists := doc.Find("button.downgrade").Attr("disabled"); !exists {
tearDownEnabled = true
out = true
}
}
return tearDownEnabled
return
}

0 comments on commit 19e1f4f

Please sign in to comment.