|
@@ -87,27 +87,56 @@ namespace TEAMModelFunction
|
|
|
scope = info.scope
|
|
|
};
|
|
|
result.info.id = cla;
|
|
|
- var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.school}"));
|
|
|
- if (sresponse.Status == 200)
|
|
|
+ if (info.scope.Equals("private", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
- Class classroom = json.ToObject<Class>();
|
|
|
- result.info.name = classroom.name;
|
|
|
- List<string> ans = new List<string>();
|
|
|
- List<double> ansPoint = new List<double>();
|
|
|
- foreach (double p in info.papers[m].point)
|
|
|
+ var sresponse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.creatorId}"));
|
|
|
+ if (sresponse.Status == 200)
|
|
|
{
|
|
|
- //ans.Add(new List<string>());
|
|
|
- ansPoint.Add(-1);
|
|
|
+ using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
+ Class classroom = json.ToObject<Class>();
|
|
|
+ result.info.name = classroom.name;
|
|
|
+ result.gradeId = classroom.gradeId;
|
|
|
+ List<string> ans = new List<string>();
|
|
|
+ List<double> ansPoint = new List<double>();
|
|
|
+ foreach (double p in info.papers[m].point)
|
|
|
+ {
|
|
|
+ //ans.Add(new List<string>());
|
|
|
+ ansPoint.Add(-1);
|
|
|
+ }
|
|
|
+ foreach (StudentSimple stu in classroom.students)
|
|
|
+ {
|
|
|
+ result.studentIds.Add(stu.id);
|
|
|
+ result.studentAnswers.Add(ans);
|
|
|
+ result.studentScores.Add(ansPoint);
|
|
|
+ result.sum.Add(0);
|
|
|
+ }
|
|
|
}
|
|
|
- foreach (StudentSimple stu in classroom.students)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.school}"));
|
|
|
+ if (sresponse.Status == 200)
|
|
|
{
|
|
|
- result.studentIds.Add(stu.id);
|
|
|
- result.studentAnswers.Add(ans);
|
|
|
- result.studentScores.Add(ansPoint);
|
|
|
- result.sum.Add(0);
|
|
|
+ using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
+ Class classroom = json.ToObject<Class>();
|
|
|
+ result.info.name = classroom.name;
|
|
|
+ result.gradeId = classroom.gradeId;
|
|
|
+ List<string> ans = new List<string>();
|
|
|
+ List<double> ansPoint = new List<double>();
|
|
|
+ foreach (double p in info.papers[m].point)
|
|
|
+ {
|
|
|
+ //ans.Add(new List<string>());
|
|
|
+ ansPoint.Add(-1);
|
|
|
+ }
|
|
|
+ foreach (StudentSimple stu in classroom.students)
|
|
|
+ {
|
|
|
+ result.studentIds.Add(stu.id);
|
|
|
+ result.studentAnswers.Add(ans);
|
|
|
+ result.studentScores.Add(ansPoint);
|
|
|
+ result.sum.Add(0);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//result.progress = info.progress;
|
|
|
result.school = info.school;
|
|
|
m++;
|