From 03925bac2f1331bffa09b62e355e8f0ba9185742 Mon Sep 17 00:00:00 2001 From: Tyler Sommer Date: Tue, 16 Jan 2018 08:02:41 -0700 Subject: [PATCH] Fix prod chain not updating after price update --- cli/command/product_editor.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cli/command/product_editor.go b/cli/command/product_editor.go index ab448fc..b5c3acd 100644 --- a/cli/command/product_editor.go +++ b/cli/command/product_editor.go @@ -238,10 +238,12 @@ 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 }) @@ -249,14 +251,16 @@ func (c ProductCommand) newProductEditor(p *model.Product) *editor.Editor { // 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 })