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...) * Gives a shit about conditions (NM, M, GD...)
* If the card is foil * 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) { if args["add"].(bool) {
serra.Add(args["<card>"].([]string)) serra.Add(args["<card>"].([]string))
} } else if args["cards"].(bool) {
if args["cards"].(bool) {
serra.Cards() serra.Cards()
} } else if args["sets"].(bool) {
if args["sets"].(bool) {
serra.Sets() serra.Sets()
} } else if args["update"].(bool) {
if args["update"].(bool) {
serra.Update() serra.Update()
} }

View File

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