stats output for foil
This commit is contained in:
parent
c784477241
commit
e0d90ae12d
@ -127,8 +127,7 @@ func show_card_list(cards []Card) {
|
||||
|
||||
var total float64
|
||||
for _, card := range cards {
|
||||
LogMessage(fmt.Sprintf("* %dx Non-Foil %s%s%s (%s/%s) %s%.2f %s%s", card.SerraCount, Purple, card.Name, Reset, card.Set, card.CollectorNumber, Yellow, card.getValue(false), getCurrency(), Reset), "normal")
|
||||
LogMessage(fmt.Sprintf("* %dx Foil %s%s%s (%s/%s) %s%.2f %s%s", card.SerraCountFoil, Purple, card.Name, Reset, card.Set, card.CollectorNumber, Yellow, card.getValue(true), getCurrency(), Reset), "normal")
|
||||
LogMessage(fmt.Sprintf("* %dx %s%s%s (%s/%s) %s%.2f %s%s", card.SerraCount+card.SerraCountFoil+card.SerraCountEtched, Purple, card.Name, Reset, card.Set, card.CollectorNumber, Yellow, card.getValue(false), getCurrency(), Reset), "normal")
|
||||
total = total + card.getValue(false)*float64(card.SerraCount) + card.getValue(true)*float64(card.SerraCountFoil)
|
||||
}
|
||||
fmt.Printf("\nTotal Value: %s%.2f %s%s\n", Yellow, total, getCurrency(), Reset)
|
||||
@ -138,10 +137,19 @@ func show_card_list(cards []Card) {
|
||||
func show_card_details(card *Card) error {
|
||||
fmt.Printf("%s%s%s (%s/%s)\n", Purple, card.Name, Reset, card.Set, card.CollectorNumber)
|
||||
fmt.Printf("Added: %s\n", stringToTime(card.SerraCreated))
|
||||
fmt.Printf("Count: %dx\n", card.SerraCount)
|
||||
fmt.Printf("Count Normal: %dx\n", card.SerraCount)
|
||||
if card.SerraCountFoil > 0 {
|
||||
fmt.Printf("Count Foil: %dx\n", card.SerraCountFoil)
|
||||
}
|
||||
if card.SerraCountEtched > 0 {
|
||||
fmt.Printf("Count Etched: %dx\n", card.SerraCountFoil)
|
||||
}
|
||||
fmt.Printf("Rarity: %s\n", card.Rarity)
|
||||
fmt.Printf("Scryfall: %s\n", strings.Replace(card.ScryfallURI, "?utm_source=api", "", 1))
|
||||
fmt.Printf("Current Value: Non-Foil %s%.2f %s%s Foil %s%.2f %s%s\n", Yellow, card.getValue(false), getCurrency(), Reset, Yellow, card.getValue(true), getCurrency(), Reset)
|
||||
fmt.Printf("Current Value: %s%.2f %s%s\n", Yellow, card.getValue(false), getCurrency(), Reset)
|
||||
if card.SerraCountFoil > 0 {
|
||||
fmt.Printf("Foil Value: %s%.2f %s%s\n", Yellow, card.getValue(true), getCurrency(), Reset)
|
||||
}
|
||||
|
||||
fmt.Printf("\n%sHistory%s\n", Green, Reset)
|
||||
print_price_history(card.SerraPrices, "* ")
|
||||
|
||||
@ -57,12 +57,19 @@ var statsCmd = &cobra.Command{
|
||||
{"count_etched", bson.D{{"$sum", "$serra_count_etched"}}},
|
||||
{"rarity", bson.D{{"$sum", "$rarity"}}},
|
||||
{"unique", bson.D{{"$sum", 1}}},
|
||||
}}},
|
||||
}},
|
||||
},
|
||||
bson.D{
|
||||
{"$addFields", bson.D{
|
||||
{"count_all", bson.D{{"$sum", bson.A{"$count", "$count_foil", "$count_etched"}}}},
|
||||
}},
|
||||
},
|
||||
})
|
||||
|
||||
fmt.Printf("\n%sCards %s\n", Green, Reset)
|
||||
fmt.Printf("Total: %s%.0f%s\n", Yellow, stats[0]["count"], Reset)
|
||||
fmt.Printf("Total: %s%.0f%s\n", Yellow, stats[0]["count_all"], Reset)
|
||||
fmt.Printf("Unique: %s%d%s\n", Purple, stats[0]["unique"], Reset)
|
||||
fmt.Printf("Normal: %s%.0f%s\n", Purple, stats[0]["count"], Reset)
|
||||
fmt.Printf("Foil: %s%d%s\n", Purple, stats[0]["count_foil"], Reset)
|
||||
fmt.Printf("Etched: %s%d%s\n", Purple, stats[0]["count_etched"], Reset)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user