Fix calc stats

This commit is contained in:
Florian Baumann 2022-08-18 16:04:57 +02:00
parent de5d07e150
commit e128985741

View File

@ -110,7 +110,7 @@ var updateCmd = &cobra.Command{
// calculate total summary over all sets // calculate total summary over all sets
overall_value := mongo.Pipeline{ overall_value := mongo.Pipeline{
bson.D{{"$match", bson.D{{"$match",
bson.D{{"serra_prices", bson.D{{"$exists", true}}}}}}, bson.D{{"serra_prices", bson.D{{"$type", "array"}}}}}},
bson.D{{"$project", bson.D{{"$project",
bson.D{{"name", true}, {"totalValue", bson.D{{"$arrayElemAt", bson.A{"$serra_prices", -1}}}}}}}, bson.D{{"name", true}, {"totalValue", bson.D{{"$arrayElemAt", bson.A{"$serra_prices", -1}}}}}}},
bson.D{{"$group", bson.D{{"_id", nil}, {"total", bson.D{{"$sum", "$totalValue.value"}}}}}}, bson.D{{"$group", bson.D{{"_id", nil}, {"total", bson.D{{"$sum", "$totalValue.value"}}}}}},