Switch to symbols instead of currency names
This commit is contained in:
parent
040561c462
commit
ba6ae6db71
@ -79,7 +79,7 @@ func addCards(cards []string, unique bool, count int64) error {
|
|||||||
c := co[0]
|
c := co[0]
|
||||||
|
|
||||||
if unique {
|
if unique {
|
||||||
LogMessage(fmt.Sprintf("Not adding \"%s\" (%s, %.2f %s) to Collection because it already exists.", c.Name, c.Rarity, c.getValue(foil), getCurrency()), "red")
|
LogMessage(fmt.Sprintf("Not adding \"%s\" (%s, %.2f%s) to Collection because it already exists.", c.Name, c.Rarity, c.getValue(foil), getCurrency()), "red")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ func addCards(cards []string, unique bool, count int64) error {
|
|||||||
total = c.SerraCount + count
|
total = c.SerraCount + count
|
||||||
}
|
}
|
||||||
// Give feedback of successfully added card
|
// Give feedback of successfully added card
|
||||||
LogMessage(fmt.Sprintf("%dx \"%s\" (%s, %.2f %s) added to Collection.", total, c.Name, c.Rarity, c.getValue(foil), getCurrency()), "green")
|
LogMessage(fmt.Sprintf("%dx \"%s\" (%s, %.2f%s) added to Collection.", total, c.Name, c.Rarity, c.getValue(foil), getCurrency()), "green")
|
||||||
|
|
||||||
// If card is not already in collection, fetching from scyfall
|
// If card is not already in collection, fetching from scyfall
|
||||||
} else {
|
} else {
|
||||||
@ -120,7 +120,7 @@ func addCards(cards []string, unique bool, count int64) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Give feedback of successfully added card
|
// Give feedback of successfully added card
|
||||||
LogMessage(fmt.Sprintf("%dx \"%s\" (%s, %.2f %s) added to Collection.", total, c.Name, c.Rarity, c.getValue(foil), getCurrency()), "green")
|
LogMessage(fmt.Sprintf("%dx \"%s\" (%s, %.2f%s) added to Collection.", total, c.Name, c.Rarity, c.getValue(foil), getCurrency()), "green")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storage_disconnect(client)
|
storage_disconnect(client)
|
||||||
|
|||||||
@ -127,10 +127,10 @@ func show_card_list(cards []Card) {
|
|||||||
|
|
||||||
var total float64
|
var total float64
|
||||||
for _, card := range cards {
|
for _, card := range cards {
|
||||||
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")
|
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)
|
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)
|
fmt.Printf("\nTotal Value: %s%.2f%s%s\n", Yellow, total, getCurrency(), Reset)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,9 +141,9 @@ func show_card_details(card *Card) error {
|
|||||||
fmt.Printf("Scryfall: %s\n", strings.Replace(card.ScryfallURI, "?utm_source=api", "", 1))
|
fmt.Printf("Scryfall: %s\n", strings.Replace(card.ScryfallURI, "?utm_source=api", "", 1))
|
||||||
|
|
||||||
fmt.Printf("\n%sCurrent Value%s\n", Green, Reset)
|
fmt.Printf("\n%sCurrent Value%s\n", Green, Reset)
|
||||||
fmt.Printf("* Normal: %dx %s%.2f %s%s\n", card.SerraCount, Yellow, card.getValue(false), getCurrency(), Reset)
|
fmt.Printf("* Normal: %dx %s%.2f%s%s\n", card.SerraCount, Yellow, card.getValue(false), getCurrency(), Reset)
|
||||||
if card.SerraCountFoil > 0 {
|
if card.SerraCountFoil > 0 {
|
||||||
fmt.Printf("* Foil: %dx %s%.2f %s%s\n", card.SerraCountFoil, Yellow, card.getValue(true), getCurrency(), Reset)
|
fmt.Printf("* Foil: %dx %s%.2f%s%s\n", card.SerraCountFoil, Yellow, card.getValue(true), getCurrency(), Reset)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("\n%sValue History%s\n", Green, Reset)
|
fmt.Printf("\n%sValue History%s\n", Green, Reset)
|
||||||
|
|||||||
@ -18,9 +18,9 @@ func getMongoDBURI() string {
|
|||||||
func getCurrency() string {
|
func getCurrency() string {
|
||||||
switch os.Getenv("SERRA_CURRENCY") {
|
switch os.Getenv("SERRA_CURRENCY") {
|
||||||
case "EUR":
|
case "EUR":
|
||||||
return "EUR"
|
return "€"
|
||||||
case "USD":
|
case "USD":
|
||||||
return "USD"
|
return "$"
|
||||||
}
|
}
|
||||||
// default
|
// default
|
||||||
LogMessage("Warning: You did not configure SERRA_CURRENCY. Assuming \"USD\"", "yellow")
|
LogMessage("Warning: You did not configure SERRA_CURRENCY. Assuming \"USD\"", "yellow")
|
||||||
|
|||||||
@ -182,11 +182,11 @@ func print_price_history(prices []PriceEntry, prefix string, total bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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())
|
||||||
} else if value < before {
|
} else if value < before {
|
||||||
fmt.Printf("%s%s%s %.2f %s%s (%+.2f%%, %+.2f %s)\n", prefix, stringToTime(e.Date), Red, 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), Red, value, getCurrency(), Reset, (value/before*100)-100, value-before, getCurrency())
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("%s%s %.2f %s%s\n", prefix, stringToTime(e.Date), value, getCurrency(), Reset)
|
fmt.Printf("%s%s %.2f%s%s\n", prefix, stringToTime(e.Date), value, getCurrency(), Reset)
|
||||||
}
|
}
|
||||||
before = value
|
before = value
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,7 @@ func removeCards(cards []string, count int64) error {
|
|||||||
|
|
||||||
if foil && c.SerraCountFoil == 1 && c.SerraCount == 0 || !foil && c.SerraCount == 1 && c.SerraCountFoil == 0 {
|
if foil && c.SerraCountFoil == 1 && c.SerraCount == 0 || !foil && c.SerraCount == 1 && c.SerraCountFoil == 0 {
|
||||||
coll.storage_remove(bson.M{"_id": c.ID})
|
coll.storage_remove(bson.M{"_id": c.ID})
|
||||||
LogMessage(fmt.Sprintf("\"%s\" (%.2f %s) removed from the Collection.", c.Name, c.getValue(foil), getCurrency()), "green")
|
LogMessage(fmt.Sprintf("\"%s\" (%.2f%s) removed from the Collection.", c.Name, c.getValue(foil), getCurrency()), "green")
|
||||||
} else {
|
} else {
|
||||||
modify_count_of_card(coll, c, -1, foil)
|
modify_count_of_card(coll, c, -1, foil)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ func show_set_list(sets []primitive.M) {
|
|||||||
setobj, _ := find_set_by_code(setscoll, set["code"].(string))
|
setobj, _ := find_set_by_code(setscoll, set["code"].(string))
|
||||||
fmt.Printf("* %s %s%s%s (%s%s%s)\n", set["release"].(string)[0:4], Purple, set["_id"], Reset, Cyan, set["code"], Reset)
|
fmt.Printf("* %s %s%s%s (%s%s%s)\n", set["release"].(string)[0:4], Purple, set["_id"], Reset, Cyan, set["code"], Reset)
|
||||||
fmt.Printf(" Cards: %s%d/%d%s Total: %.0f \n", Yellow, set["unique"], setobj.CardCount, Reset, set["count"])
|
fmt.Printf(" Cards: %s%d/%d%s Total: %.0f \n", Yellow, set["unique"], setobj.CardCount, Reset, set["count"])
|
||||||
fmt.Printf(" Value: %s%.2f %s%s\n", Pink, set["value"], getCurrency(), Reset)
|
fmt.Printf(" Value: %s%.2f%s%s\n", Pink, set["value"], getCurrency(), Reset)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ func ShowSet(setname string) error {
|
|||||||
foil_value = 0
|
foil_value = 0
|
||||||
}
|
}
|
||||||
total_value := nf_value + foil_value
|
total_value := nf_value + foil_value
|
||||||
LogMessage(fmt.Sprintf("Total Value: %.2f %s", total_value, getCurrency()), "normal")
|
LogMessage(fmt.Sprintf("Total Value: %.2f%s", total_value, getCurrency()), "normal")
|
||||||
LogMessage(fmt.Sprintf("Released: %s", sets[0].ReleasedAt), "normal")
|
LogMessage(fmt.Sprintf("Released: %s", sets[0].ReleasedAt), "normal")
|
||||||
LogMessage(fmt.Sprintf("Mythics: %.0f", ri.Mythics), "normal")
|
LogMessage(fmt.Sprintf("Mythics: %.0f", ri.Mythics), "normal")
|
||||||
LogMessage(fmt.Sprintf("Rares: %.0f", ri.Rares), "normal")
|
LogMessage(fmt.Sprintf("Rares: %.0f", ri.Rares), "normal")
|
||||||
@ -176,7 +176,7 @@ func ShowSet(setname string) error {
|
|||||||
|
|
||||||
for i := 0; i < ccards; i++ {
|
for i := 0; i < ccards; i++ {
|
||||||
card := cards[i]
|
card := cards[i]
|
||||||
fmt.Printf("* %s%s%s (%s/%s) %s%.2f %s%s\n", Purple, card.Name, Reset, sets[0].Code, card.CollectorNumber, Yellow, card.getValue(false), getCurrency(), Reset)
|
fmt.Printf("* %s%s%s (%s/%s) %s%.2f%s%s\n", Purple, card.Name, Reset, sets[0].Code, card.CollectorNumber, Yellow, card.getValue(false), getCurrency(), Reset)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -120,9 +120,9 @@ var statsCmd = &cobra.Command{
|
|||||||
foil_value = 0
|
foil_value = 0
|
||||||
}
|
}
|
||||||
total_value := nf_value + foil_value
|
total_value := nf_value + foil_value
|
||||||
fmt.Printf("Total: %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("Normal: %s%.2f%s%s\n", Pink, nf_value, getCurrency(), Reset)
|
||||||
fmt.Printf("Foils: %s%.2f %s%s\n", Pink, foil_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")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user