parent
f703d83361
commit
b3f57c21c5
@ -90,23 +90,15 @@ func find_set_by_code(coll *Collection, setcode string) (*Set, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func show_card_details(card *Card) error {
|
func show_card_details(card *Card) error {
|
||||||
fmt.Printf("* %dx %s%s%s (%s/%s)\n", card.SerraCount, Purple, card.Name, Reset, card.Set, card.CollectorNumber)
|
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("Added: %s\n", stringToTime(card.SerraCreated))
|
||||||
fmt.Printf(" Rarity: %s\n", card.Rarity)
|
fmt.Printf("Count: %dx\n", card.SerraCount)
|
||||||
fmt.Printf(" Scryfall: %s\n", strings.Replace(card.ScryfallURI, "?utm_source=api", "", 1))
|
fmt.Printf("Rarity: %s\n", card.Rarity)
|
||||||
fmt.Printf(" Current Value: %s%.2f EUR%s\n", Yellow, card.Prices.Eur, Reset)
|
fmt.Printf("Scryfall: %s\n", strings.Replace(card.ScryfallURI, "?utm_source=api", "", 1))
|
||||||
fmt.Printf(" History:\n")
|
fmt.Printf("Current Value: %s%.2f EUR%s\n", Yellow, card.Prices.Eur, Reset)
|
||||||
var before float64
|
|
||||||
for _, e := range card.SerraPrices {
|
fmt.Printf("\n%sHistory%s\n", Green, Reset)
|
||||||
if e.Value > before {
|
print_price_history(card.SerraPrices, "* ")
|
||||||
fmt.Printf(" * %s %s%.2f EUR%s\n", stringToTime(e.Date), Green, e.Value, Reset)
|
|
||||||
} else if e.Value < before {
|
|
||||||
fmt.Printf(" * %s %s%.2f EUR%s\n", stringToTime(e.Date), Red, e.Value, Reset)
|
|
||||||
} else {
|
|
||||||
fmt.Printf(" * %s %.2f EUR\n", stringToTime(e.Date), e.Value)
|
|
||||||
}
|
|
||||||
before = e.Value
|
|
||||||
}
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -168,3 +160,18 @@ func convert_rarities(rar []primitive.M) Rarities {
|
|||||||
return ri
|
return ri
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func print_price_history(prices []PriceEntry, prefix string) {
|
||||||
|
|
||||||
|
var before float64
|
||||||
|
for _, e := range prices {
|
||||||
|
if e.Value > before && before != 0 {
|
||||||
|
fmt.Printf("%s%s%s %.2f EUR%s (%+.2f%%)\n", prefix, stringToTime(e.Date), Green, e.Value, Reset, (e.Value/before*100)-100)
|
||||||
|
} else if e.Value < before {
|
||||||
|
fmt.Printf("%s%s%s %.2f EUR%s (%+.2f%%)\n", prefix, stringToTime(e.Date), Red, e.Value, Reset, (e.Value/before*100)-100)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("%s%s %.2f EUR%s\n", prefix, stringToTime(e.Date), e.Value, Reset)
|
||||||
|
}
|
||||||
|
before = e.Value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -280,18 +280,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, "* ")
|
||||||
var before float64
|
|
||||||
for _, e := range sets[0].SerraPrices {
|
|
||||||
if e.Value > before {
|
|
||||||
fmt.Printf("* %s %s%.2f EUR%s\n", stringToTime(e.Date), Green, e.Value, Reset)
|
|
||||||
} else if e.Value < before {
|
|
||||||
fmt.Printf("* %s %s%.2f EUR%s\n", stringToTime(e.Date), Red, e.Value, Reset)
|
|
||||||
} else {
|
|
||||||
fmt.Printf("* %s %.2f EUR%s\n", stringToTime(e.Date), e.Value)
|
|
||||||
}
|
|
||||||
before = e.Value
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("\n%sMost valuable cards%s\n", Pink, Reset)
|
fmt.Printf("\n%sMost valuable cards%s\n", Pink, Reset)
|
||||||
ccards := 0
|
ccards := 0
|
||||||
@ -591,18 +580,9 @@ func Stats() {
|
|||||||
fmt.Printf("Current: %s%.2f%s\n", Pink, stats[0]["value"], Reset)
|
fmt.Printf("Current: %s%.2f%s\n", Pink, stats[0]["value"], Reset)
|
||||||
total, _ := totalcoll.storage_find_total()
|
total, _ := totalcoll.storage_find_total()
|
||||||
|
|
||||||
var before float64
|
|
||||||
fmt.Printf("History: \n")
|
fmt.Printf("History: \n")
|
||||||
for _, e := range total.Value {
|
print_price_history(total.Value, "* ")
|
||||||
if e.Value > before {
|
|
||||||
fmt.Printf("* %s %s%.2f EUR%s\n", stringToTime(e.Date), Green, e.Value, Reset)
|
|
||||||
} else if e.Value < before {
|
|
||||||
fmt.Printf("* %s %s%.2f EUR%s\n", stringToTime(e.Date), Red, e.Value, Reset)
|
|
||||||
} else {
|
|
||||||
fmt.Printf("* %s %.2f EUR\n", stringToTime(e.Date), e.Value)
|
|
||||||
}
|
|
||||||
before = e.Value
|
|
||||||
}
|
|
||||||
// LogMessage(fmt.Sprintf("Mana costs in Collection"), "green")
|
// LogMessage(fmt.Sprintf("Mana costs in Collection"), "green")
|
||||||
// groupStage = bson.D{
|
// groupStage = bson.D{
|
||||||
// {"$group", bson.D{
|
// {"$group", bson.D{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user