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)
|
||||
print_price_history(card.SerraPrices, "* ")
|
||||
print_price_history(card.SerraPrices, "* ", false)
|
||||
fmt.Println()
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -163,14 +163,22 @@ 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
|
||||
for _, e := range prices {
|
||||
|
||||
value := e.Usd
|
||||
if getCurrency() == "EUR" {
|
||||
value = e.Eur
|
||||
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" {
|
||||
value = e.Eur
|
||||
}
|
||||
}
|
||||
|
||||
if value > before && before != 0 {
|
||||
|
||||
@ -162,7 +162,7 @@ func ShowSet(setname string) error {
|
||||
LogMessage(fmt.Sprintf("Uncommons: %.0f", ri.Uncommons), "normal")
|
||||
LogMessage(fmt.Sprintf("Commons: %.0f", ri.Commons), "normal")
|
||||
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)
|
||||
|
||||
|
||||
@ -120,11 +120,13 @@ var statsCmd = &cobra.Command{
|
||||
foil_value = 0
|
||||
}
|
||||
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()
|
||||
|
||||
fmt.Printf("History: \n")
|
||||
print_price_history(total.Value, "* ")
|
||||
print_price_history(total.Value, "* ", true)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user