Skip to content

Commit

Permalink
Fix prod chain not updating after price update
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-sommer committed Jan 16, 2018
1 parent 560cfed commit 03925ba
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cli/command/product_editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,25 +238,29 @@ func (c ProductCommand) newProductEditor(p *model.Product) *editor.Editor {
}
}
setRegion(p)
if _, err := c.client.UpdateProductPrices(p); err != nil {
prod, err := c.client.UpdateProductPrices(p)
if err != nil {
c.logger.Errorf("unable to fetch market prices for region %d: %s", region.RegionID, err.Error())
fmt.Println("Error loading production chain prices, try again.")
}
*p = *prod
fmt.Printf("Updated %s target region to %s.\n", c.getProductName(p), c.getRegionName(p.MarketRegionID))
return nil
})

// Update all product costs per unit to current market values.
cmdUpdateMarketPrices = editor.NewCommand(
"U",
"Update market prices from evemarketer.com.",
"Update market prices with regional data from evemarketer.com.",
[]string{},
func(_ []string) error {
if _, err := c.client.UpdateProductPrices(p); err != nil {
prod, err := c.client.UpdateProductPrices(p)
if err != nil {
c.logger.Errorf("unable to fetch market prices for region %d: %s", p.MarketRegionID, err.Error())
fmt.Println("Error loading production chain prices, try again.")
return nil
}
*p = *prod
fmt.Println("Production chain prices updated.")
return nil
})
Expand Down

0 comments on commit 03925ba

Please sign in to comment.