update prices
This commit is contained in:
parent
3a17b20a3f
commit
95ca072544
@ -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})
|
||||||
|
|||||||
12
serra.go
12
serra.go
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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}}}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user