|
@@ -154,45 +154,44 @@ namespace TEAMModelFunction
|
|
|
scope = info.scope
|
|
|
};
|
|
|
result.info.id = cla;
|
|
|
- if (info.scope.Equals("private", StringComparison.OrdinalIgnoreCase))
|
|
|
+ List<string> ans = new List<string>();
|
|
|
+ List<double> ansPoint = new List<double>();
|
|
|
+ List<string> ids = new List<string>();
|
|
|
+ foreach (double p in info.papers[m].point)
|
|
|
{
|
|
|
-
|
|
|
- List<string> ans = new List<string>();
|
|
|
- List<double> ansPoint = new List<double>();
|
|
|
- List<string> ids = new List<string>();
|
|
|
- foreach (double p in info.papers[m].point)
|
|
|
- {
|
|
|
- //ans.Add(new List<string>());
|
|
|
- ansPoint.Add(-1);
|
|
|
- }
|
|
|
- var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.school}"));
|
|
|
- if (sresponse.Status == 200)
|
|
|
+ //ans.Add(new List<string>());
|
|
|
+ ansPoint.Add(-1);
|
|
|
+ }
|
|
|
+ var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.school}"));
|
|
|
+ if (sresponse.Status == 200)
|
|
|
+ {
|
|
|
+ using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
+ Class classroom = json.ToObject<Class>();
|
|
|
+ //result.info.id = classroom.id;
|
|
|
+ result.info.name = classroom.name;
|
|
|
+ result.gradeId = classroom.gradeId;
|
|
|
+ //处理班级人数
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.classId = '{classroom.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{info.school}") }))
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
- Class classroom = json.ToObject<Class>();
|
|
|
- result.info.id = classroom.id;
|
|
|
- result.info.name = classroom.name;
|
|
|
- result.gradeId = classroom.gradeId;
|
|
|
- //处理班级人数
|
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.classId = '{classroom.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{info.school}") }))
|
|
|
+ using var json_stu = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ if (json_stu.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
- using var json_stu = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
- if (json_stu.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
+ var accounts = json_stu.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
+ while (accounts.MoveNext())
|
|
|
{
|
|
|
- var accounts = json_stu.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
- while (accounts.MoveNext())
|
|
|
- {
|
|
|
- JsonElement account = accounts.Current;
|
|
|
- ids.Add(account.GetProperty("id").GetString());
|
|
|
- }
|
|
|
+ JsonElement account = accounts.Current;
|
|
|
+ ids.Add(account.GetProperty("id").GetString());
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+ if (info.scope.Equals("private", StringComparison.OrdinalIgnoreCase))
|
|
|
+ {
|
|
|
var stuResponse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"StuList"));
|
|
|
if (sresponse.Status == 200) {
|
|
|
using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
StuList stuList = json.ToObject<StuList>();
|
|
|
- result.info.id = stuList.id;
|
|
|
+ //result.info.id = stuList.id;
|
|
|
result.info.name = stuList.name;
|
|
|
//处理发布对象为自选名单(个人)
|
|
|
|
|
@@ -217,59 +216,17 @@ namespace TEAMModelFunction
|
|
|
ids.Add(tid);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- foreach (string stu in ids)
|
|
|
- {
|
|
|
- result.studentIds.Add(stu);
|
|
|
- result.studentAnswers.Add(ans);
|
|
|
- result.studentScores.Add(ansPoint);
|
|
|
- result.sum.Add(0);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
- else {
|
|
|
- List<string> ans = new List<string>();
|
|
|
- List<double> ansPoint = new List<double>();
|
|
|
- List<string> ids = new List<string>();
|
|
|
- var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.school}"));
|
|
|
- if (sresponse.Status == 200)
|
|
|
- {
|
|
|
- using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
- Class classroom = json.ToObject<Class>();
|
|
|
- result.info.name = classroom.name;
|
|
|
- result.info.id = classroom.id;
|
|
|
- result.gradeId = classroom.gradeId;
|
|
|
-
|
|
|
- foreach (double p in info.papers[m].point)
|
|
|
- {
|
|
|
- //ans.Add(new List<string>());
|
|
|
- ansPoint.Add(-1);
|
|
|
- }
|
|
|
- //处理班级人数
|
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.classId = '{classroom.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{info.school}") }))
|
|
|
- {
|
|
|
- using var json_stu = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
- if (json_stu.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
- {
|
|
|
- var accounts = json_stu.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
- while (accounts.MoveNext())
|
|
|
- {
|
|
|
- JsonElement account = accounts.Current;
|
|
|
- ids.Add(account.GetProperty("id").GetString());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ else {
|
|
|
var stuResponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"StuList-{info.school}"));
|
|
|
if (sresponse.Status == 200)
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
StuList stuList = json.ToObject<StuList>();
|
|
|
- result.info.id = stuList.id;
|
|
|
+ //result.info.id = stuList.id;
|
|
|
result.info.name = stuList.name;
|
|
|
//处理发布对象为自选名单(校本)
|
|
|
-
|
|
|
foreach (Students students in stuList.students)
|
|
|
{
|
|
|
if (students.code.Contains(code))
|
|
@@ -284,16 +241,16 @@ namespace TEAMModelFunction
|
|
|
ids.Add(students.id);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- foreach (string stu in ids)
|
|
|
- {
|
|
|
- result.studentIds.Add(stu);
|
|
|
- result.studentAnswers.Add(ans);
|
|
|
- result.studentScores.Add(ansPoint);
|
|
|
- result.sum.Add(0);
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach (string stu in ids)
|
|
|
+ {
|
|
|
+ result.studentIds.Add(stu);
|
|
|
+ result.studentAnswers.Add(ans);
|
|
|
+ result.studentScores.Add(ansPoint);
|
|
|
+ result.sum.Add(0);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//result.progress = info.progress;
|
|
|
result.school = info.school;
|
|
|
m++;
|