use of com.epam.ta.reportportal.database.entity.history.status.FlakyHistory in project commons-dao by reportportal.
the class TestItemRepositoryCustomImpl method getFlakyItemStatusHistory.
@Override
public List<FlakyHistory> getFlakyItemStatusHistory(List<String> launchIds) {
/*
db.testItem.aggregate([
{ "$match" : { $and: [ "launchRef" : { "$in" : [""]}, has_childs : false ]}},
{ "$sort" : { "start_time" : 1}},
{ "$group" : {
"_id" : "$uniqueId" ,
"total" : { "$sum" : 1 },
"statusHistory" : { "$push" : {
"status" : "$status",
"time" : "$start_time"
}
},
"statusSet" : { "$addToSet" : "$status" },
"name" : {"$first" : "$name"},
}},
{ "$addFields" : { "size" : {"$size" : "$statusSet" }}},
{ "$match" : { "size " : {"$gt" : 1}}}
])
*/
final int MINIMUM_FOR_FLAKY = 1;
Aggregation aggregation = newAggregation(match(where(LAUNCH_REFERENCE).in(launchIds).and(HAS_CHILD).is(false)), sort(Sort.Direction.ASC, START_TIME), flakyItemsGroup(), addFields("size", new BasicDBObject("$size", "$statusSet")), match(where("size").gt(MINIMUM_FOR_FLAKY)));
return mongoTemplate.aggregate(aggregation, mongoTemplate.getCollectionName(TestItem.class), FlakyHistory.class).getMappedResults();
}
Aggregations