update prices

This commit is contained in:
Florian Baumann 2022-01-03 11:07:13 +01:00
parent 3a17b20a3f
commit 95ca072544
3 changed files with 10 additions and 10 deletions

View File

@ -24,3 +24,9 @@ optional
* Gives a shit about conditions (NM, M, GD...)
* If the card is foil
# Cheatsheet
Find cards that increased prices
db.cards.find({$expr: {$gt: [{$arrayElemAt: ["$serra_prices", -2]}, {$arrayElemAt: ["$serra_prices", -1]}]}}, {name:1})

View File

@ -26,17 +26,11 @@ Options:
if args["add"].(bool) {
serra.Add(args["<card>"].([]string))
}
if args["cards"].(bool) {
} else if args["cards"].(bool) {
serra.Cards()
}
if args["sets"].(bool) {
} else if args["sets"].(bool) {
serra.Sets()
}
if args["update"].(bool) {
} else if args["update"].(bool) {
serra.Update()
}

View File

@ -110,7 +110,7 @@ func Update() {
filter := bson.M{"_id": bson.M{"$eq": card.ID}}
update := bson.M{
"$set": bson.M{"serra_updated": primitive.NewDateTimeFromTime(time.Now())},
"$set": bson.M{"serra_updated": primitive.NewDateTimeFromTime(time.Now()), "prices": updated_card.Prices},
"$push": bson.M{"serra_prices": bson.M{"date": primitive.NewDateTimeFromTime(time.Now()),
"value": updated_card.Prices.Eur}}}