|
@@ -400,7 +400,7 @@ namespace TEAMModelOS.SDK.Services
|
|
|
|
|
|
source = $" and c.source = '{sc}' ";
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
string owner = "";
|
|
|
//评测来源
|
|
|
if (request.TryGetProperty("owner", out JsonElement element))
|
|
@@ -431,7 +431,7 @@ namespace TEAMModelOS.SDK.Services
|
|
|
typesql = $" and c.type='{type}' ";
|
|
|
}
|
|
|
}
|
|
|
- string continuationToken = default;
|
|
|
+ string token = default;
|
|
|
//默认不指定返回大小
|
|
|
int? topcout = null;
|
|
|
if (request.TryGetProperty("count", out JsonElement jcount))
|
|
@@ -448,12 +448,12 @@ namespace TEAMModelOS.SDK.Services
|
|
|
iscontinuation = true;
|
|
|
}
|
|
|
//如果指定了返回大小
|
|
|
- if (request.TryGetProperty("continuationToken", out JsonElement token))
|
|
|
+ if (request.TryGetProperty("continuationToken", out JsonElement token_1))
|
|
|
{
|
|
|
//指定了cancellationToken continuationSchool
|
|
|
- if (!token.ValueKind.Equals(JsonValueKind.Null) && token.ValueKind.Equals(JsonValueKind.String))
|
|
|
+ if (!token_1.ValueKind.Equals(JsonValueKind.Null) && token_1.ValueKind.Equals(JsonValueKind.String))
|
|
|
{
|
|
|
- continuationToken = token.GetString();
|
|
|
+ token = token_1.GetString();
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -489,9 +489,9 @@ namespace TEAMModelOS.SDK.Services
|
|
|
containerId = "Student";
|
|
|
PartitionKey = $"Activity-{id}";
|
|
|
}
|
|
|
- string querySchool = $" SELECT distinct value c FROM c {joinSqlSubjects} where c.pk='Activity' {stimesql} {etimesql} {typesql} {andSqlSubjects} {source} {owner} {name} order by c.createTime desc";
|
|
|
+ string querySchool = $" SELECT value c FROM c {joinSqlSubjects} where c.pk='Activity' {stimesql} {etimesql} {typesql} {andSqlSubjects} {source} {owner} {name} order by c.createTime desc";
|
|
|
//查询数据归属学校的
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, containerId).GetItemQueryStreamIterator(querySchool, continuationToken: continuationToken,
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, containerId).GetItemQueryStreamIterator(querySchool, continuationToken: token,
|
|
|
requestOptions: new QueryRequestOptions() { MaxItemCount = topcout, PartitionKey = new PartitionKey(PartitionKey) }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
@@ -500,55 +500,17 @@ namespace TEAMModelOS.SDK.Services
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
{
|
|
|
datas.Add(obj.ToObject<StuActivity>());
|
|
|
- }
|
|
|
- //如果需要分页则跳出
|
|
|
- if (iscontinuation)
|
|
|
- {
|
|
|
- continuationToken = item.GetContinuationToken();
|
|
|
- break;
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果需要分页则跳出
|
|
|
+ if (iscontinuation)
|
|
|
+ {
|
|
|
+ token = item.GetContinuationToken();
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- /* List<(string id, HashSet<string> name)> cn = new();
|
|
|
- foreach (StuActivity activity in datas) {
|
|
|
- var cIds = activity.classIds;
|
|
|
- HashSet<string> name = new HashSet<string>();
|
|
|
- if (cIds.ToList().Count > 0)
|
|
|
- {
|
|
|
- List<GroupListDto> groups = await GroupListService.GetGroupListListids(client, _dingDing, cIds.ToList(), school);
|
|
|
- foreach (GroupListDto dto in groups)
|
|
|
- {
|
|
|
- name.Add(dto.name);
|
|
|
- }
|
|
|
- cn.Add((activity.id, name));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //string SummarySql = " c.id,c.code,c.name,c.no,c.periodId,c.scope,c.school,c.creatorId,c.type,c.year,c.tcount,c.scount,c.leader ";
|
|
|
-
|
|
|
- datas.Select(item => new {
|
|
|
- item.name,
|
|
|
- item.classIds,
|
|
|
- cName = cn.Where(c =>c.id.Equals(item.id)).FirstOrDefault().name,
|
|
|
- item.code,
|
|
|
- item.createTime,
|
|
|
- item.creatorId,
|
|
|
- item.id,
|
|
|
- item.owner,
|
|
|
- item.endTime,
|
|
|
- item.startTime,
|
|
|
- item.pk,
|
|
|
- item.sStatus,
|
|
|
- item.school,
|
|
|
- item.scode,
|
|
|
- item.scope,
|
|
|
- item.source,
|
|
|
- item.subjects,
|
|
|
- item.taskStatus,
|
|
|
- item.type
|
|
|
-
|
|
|
- });*/
|
|
|
- return (datas, continuationToken);
|
|
|
+ List<StuActivity> results = datas.Where((x, i) => datas.FindIndex(z => z.id == x.id && z.code == x.code) == i).ToList();
|
|
|
+ return (results, token);
|
|
|
}
|
|
|
|
|
|
|