|
@@ -197,36 +197,38 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
List<(string id, double score, List<HomeworkComment> comments, string comid)> work = new();
|
|
|
//List<string> comid = new();
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(
|
|
|
+ if (wIds.Count > 0) {
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(
|
|
|
queryText: $"select c.id,c.score,c.comments,c.comid from c where c.id in ({string.Join(",", wIds.Select(o => $"'{o.id}'"))})",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey(partitionKey) }))
|
|
|
- {
|
|
|
- using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
- if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
- var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
- while (accounts.MoveNext())
|
|
|
+ using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
- JsonElement account = accounts.Current;
|
|
|
- double sc = 0;
|
|
|
- List<HomeworkComment> hc = new();
|
|
|
- if (account.TryGetProperty("score", out JsonElement score))
|
|
|
+ var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
+ while (accounts.MoveNext())
|
|
|
{
|
|
|
- sc = score.GetDouble();
|
|
|
- if (sc == -1)
|
|
|
+ JsonElement account = accounts.Current;
|
|
|
+ double sc = 0;
|
|
|
+ List<HomeworkComment> hc = new();
|
|
|
+ if (account.TryGetProperty("score", out JsonElement score))
|
|
|
{
|
|
|
- sc = 0;
|
|
|
+ sc = score.GetDouble();
|
|
|
+ if (sc == -1)
|
|
|
+ {
|
|
|
+ sc = 0;
|
|
|
+ }
|
|
|
}
|
|
|
+ if (account.TryGetProperty("comments", out JsonElement comments))
|
|
|
+ {
|
|
|
+ hc = comments.ToObject<List<HomeworkComment>>();
|
|
|
+ }
|
|
|
+ //comid.Add(account.GetProperty("comid").GetString());
|
|
|
+ work.Add((account.GetProperty("id").GetString(), sc, hc, account.GetProperty("comid").GetString()));
|
|
|
}
|
|
|
- if (account.TryGetProperty("comments", out JsonElement comments))
|
|
|
- {
|
|
|
- hc = comments.ToObject<List<HomeworkComment>>();
|
|
|
- }
|
|
|
- //comid.Add(account.GetProperty("comid").GetString());
|
|
|
- work.Add((account.GetProperty("id").GetString(), sc, hc, account.GetProperty("comid").GetString()));
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
List<(string id, List<DebateReply> comments)> debates = new();
|
|
|
List<string> scomid = new();
|
|
|
List<string> tcomid = new();
|