Add price lists capability for foils
This commit is contained in:
parent
e0d90ae12d
commit
2ed9467f6a
@ -152,7 +152,7 @@ func show_card_details(card *Card) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("\n%sHistory%s\n", Green, Reset)
|
fmt.Printf("\n%sHistory%s\n", Green, Reset)
|
||||||
print_price_history(card.SerraPrices, "* ")
|
print_price_history(card.SerraPrices, "* ", false)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,15 +163,23 @@ func convert_rarities(rar []primitive.M) Rarities {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func print_price_history(prices []PriceEntry, prefix string) {
|
func print_price_history(prices []PriceEntry, prefix string, total bool) {
|
||||||
|
|
||||||
var before float64
|
var before float64
|
||||||
for _, e := range prices {
|
for _, e := range prices {
|
||||||
|
|
||||||
value := e.Usd
|
var value float64
|
||||||
|
if total {
|
||||||
|
value = e.Usd + e.UsdFoil + e.UsdEtched
|
||||||
|
if getCurrency() == "EUR" {
|
||||||
|
value = e.Eur + e.EurFoil
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
value = e.Usd
|
||||||
if getCurrency() == "EUR" {
|
if getCurrency() == "EUR" {
|
||||||
value = e.Eur
|
value = e.Eur
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if value > before && before != 0 {
|
if value > before && before != 0 {
|
||||||
fmt.Printf("%s%s%s %.2f %s%s (%+.2f%%, %+.2f %s)\n", prefix, stringToTime(e.Date), Green, value, getCurrency(), Reset, (value/before*100)-100, value-before, getCurrency())
|
fmt.Printf("%s%s%s %.2f %s%s (%+.2f%%, %+.2f %s)\n", prefix, stringToTime(e.Date), Green, value, getCurrency(), Reset, (value/before*100)-100, value-before, getCurrency())
|
||||||
|
|||||||
@ -162,7 +162,7 @@ func ShowSet(setname string) error {
|
|||||||
LogMessage(fmt.Sprintf("Uncommons: %.0f", ri.Uncommons), "normal")
|
LogMessage(fmt.Sprintf("Uncommons: %.0f", ri.Uncommons), "normal")
|
||||||
LogMessage(fmt.Sprintf("Commons: %.0f", ri.Commons), "normal")
|
LogMessage(fmt.Sprintf("Commons: %.0f", ri.Commons), "normal")
|
||||||
fmt.Printf("\n%sPrice History:%s\n", Pink, Reset)
|
fmt.Printf("\n%sPrice History:%s\n", Pink, Reset)
|
||||||
print_price_history(sets[0].SerraPrices, "* ")
|
print_price_history(sets[0].SerraPrices, "* ", true)
|
||||||
|
|
||||||
fmt.Printf("\n%sMost valuable cards%s\n", Pink, Reset)
|
fmt.Printf("\n%sMost valuable cards%s\n", Pink, Reset)
|
||||||
|
|
||||||
|
|||||||
@ -120,11 +120,13 @@ var statsCmd = &cobra.Command{
|
|||||||
foil_value = 0
|
foil_value = 0
|
||||||
}
|
}
|
||||||
total_value := nf_value + foil_value
|
total_value := nf_value + foil_value
|
||||||
fmt.Printf("Current: %s%.2f %s%s\n", Pink, total_value, getCurrency(), Reset)
|
fmt.Printf("Total: %s%.2f %s%s\n", Pink, total_value, getCurrency(), Reset)
|
||||||
|
fmt.Printf("Normal: %s%.2f %s%s\n", Pink, nf_value, getCurrency(), Reset)
|
||||||
|
fmt.Printf("Foils: %s%.2f %s%s\n", Pink, foil_value, getCurrency(), Reset)
|
||||||
total, _ := totalcoll.storage_find_total()
|
total, _ := totalcoll.storage_find_total()
|
||||||
|
|
||||||
fmt.Printf("History: \n")
|
fmt.Printf("History: \n")
|
||||||
print_price_history(total.Value, "* ")
|
print_price_history(total.Value, "* ", true)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user