|
@@ -87,17 +87,16 @@ namespace TEAMModelOS.Controllers.XTest
|
|
{
|
|
{
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
List<ItemInfo> items = new List<ItemInfo>();
|
|
List<ItemInfo> items = new List<ItemInfo>();
|
|
- var queryslt = $"SELECT value(c) FROM c ";
|
|
|
|
-
|
|
|
|
|
|
+ var queryslt = $"SELECT value(c) FROM c where c.pid = null ";
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-hbcn") }))
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-hbcn") }))
|
|
{
|
|
{
|
|
|
|
|
|
items.Add(item);
|
|
items.Add(item);
|
|
}
|
|
}
|
|
List<ItemCond> itemConds = new List<ItemCond>();
|
|
List<ItemCond> itemConds = new List<ItemCond>();
|
|
- items.GroupBy(x => x.periodId).ToList().ForEach(x => {
|
|
|
|
- ItemCond cond = new ItemCond() { id = x.Key, code = $"ItemCond-hbcn", pk = "ItemCond", ttl = -1, count = 0, grades = new List<GradeCount>(), subjects = new List<SubjectCount>() };
|
|
|
|
- x.ToList().ForEach(y => {
|
|
|
|
|
|
+ items.GroupBy(x => x.periodId).Select(y => new { key = y.Key, list = y.ToList() }).ToList().ForEach(z => {
|
|
|
|
+ ItemCond cond = new ItemCond() { id = z.key, code = $"ItemCond-hbcn", pk = "ItemCond", ttl = -1, count = z.list.Count, grades = new List<GradeCount>(), subjects = new List<SubjectCount>() };
|
|
|
|
+ z.list.ForEach(y => {
|
|
ItemService.CountItemCond(y, null, cond);
|
|
ItemService.CountItemCond(y, null, cond);
|
|
});
|
|
});
|
|
|
|
|