Handle legacy attempts during statistics backfill
This commit is contained in:
@@ -154,6 +154,10 @@ public sealed class AnswerStatisticsStore
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (MongoCommandException exception) when (exception.Code == 11000)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task MarkBackfillCompleteAsync(string owner)
|
||||
@@ -203,7 +207,13 @@ public sealed class AnswerStatisticsStore
|
||||
new BsonDocument("$match", match),
|
||||
new BsonDocument("$group", new BsonDocument
|
||||
{
|
||||
{ "_id", new BsonDocument { { "q", "$QuestionExternalId" }, { "b", "$CounterBucket" }, { "c", "$ChoiceId" } } },
|
||||
{ "_id", new BsonDocument
|
||||
{
|
||||
{ "q", "$QuestionExternalId" },
|
||||
{ "b", new BsonDocument("$ifNull", new BsonArray { "$CounterBucket", 0 }) },
|
||||
{ "c", "$ChoiceId" }
|
||||
}
|
||||
},
|
||||
{ "count", new BsonDocument("$sum", 1) }
|
||||
})
|
||||
};
|
||||
@@ -214,7 +224,13 @@ public sealed class AnswerStatisticsStore
|
||||
new BsonDocument("$unwind", "$PresentedChoiceIds"),
|
||||
new BsonDocument("$group", new BsonDocument
|
||||
{
|
||||
{ "_id", new BsonDocument { { "q", "$QuestionExternalId" }, { "b", "$CounterBucket" }, { "c", "$PresentedChoiceIds" } } },
|
||||
{ "_id", new BsonDocument
|
||||
{
|
||||
{ "q", "$QuestionExternalId" },
|
||||
{ "b", new BsonDocument("$ifNull", new BsonArray { "$CounterBucket", 0 }) },
|
||||
{ "c", "$PresentedChoiceIds" }
|
||||
}
|
||||
},
|
||||
{ "count", new BsonDocument("$sum", 1) }
|
||||
})
|
||||
};
|
||||
@@ -231,7 +247,12 @@ public sealed class AnswerStatisticsStore
|
||||
new BsonDocument("$match", legacyMatch),
|
||||
new BsonDocument("$group", new BsonDocument
|
||||
{
|
||||
{ "_id", new BsonDocument { { "q", "$QuestionExternalId" }, { "b", "$CounterBucket" } } },
|
||||
{ "_id", new BsonDocument
|
||||
{
|
||||
{ "q", "$QuestionExternalId" },
|
||||
{ "b", new BsonDocument("$ifNull", new BsonArray { "$CounterBucket", 0 }) }
|
||||
}
|
||||
},
|
||||
{ "count", new BsonDocument("$sum", 1) }
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user