|
@@ -651,7 +651,6 @@ namespace TEAMModelOS.Controllers.Common
|
|
|
if (!token_1.ValueKind.Equals(JsonValueKind.Null) && token_1.ValueKind.Equals(JsonValueKind.String))
|
|
|
{
|
|
|
token = token_1.GetString();
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
List<JointExamIdCollector> jointExamIdCollectorsPrivate = new List<JointExamIdCollector>();
|
|
@@ -699,6 +698,24 @@ namespace TEAMModelOS.Controllers.Common
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ //取得Exam
|
|
|
+ List<ExamInfo> exams = new List<ExamInfo>();
|
|
|
+ List<string> jointExamIds = jointExamInfo.Select(x => x.id).ToList();
|
|
|
+ if (jointExamIds.Count > 0)
|
|
|
+ {
|
|
|
+ StringBuilder stringBuilderExam = new($"SELECT * FROM c WHERE CONTAINS(c.code, 'Exam-', true) AND ARRAY_CONTAINS({JsonSerializer.Serialize(jointExamIds)}, c.jointExamId)");
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Common).GetItemQueryStreamIteratorSql(queryText: stringBuilderExam.ToString(), requestOptions: null))
|
|
|
+ {
|
|
|
+ using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
+ if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
+ {
|
|
|
+ foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
+ {
|
|
|
+ exams.Add(obj.ToObject<ExamInfo>());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//取得老師報名的JointCourse
|
|
|
List<JointEventGroupDb> jointEventGroup = new List<JointEventGroupDb>(); //個人課程
|
|
|
if (jointExamIdCollectorsPrivate.Count > 0)
|
|
@@ -722,6 +739,12 @@ namespace TEAMModelOS.Controllers.Common
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
{
|
|
|
JointEventGroupDb jointEventGroupRow = obj.ToObject<JointEventGroupDb>();
|
|
|
+ foreach(var course in jointEventGroupRow.courseLists)
|
|
|
+ {
|
|
|
+ if(jointEventGroupRow.scope.Equals("private") && string.IsNullOrWhiteSpace(course.subjectId) && !string.IsNullOrWhiteSpace(course.courseId)) course.subjectId = course.courseId;
|
|
|
+ ExamInfo examRelated = exams.Where(e => e.subjects.Select(s => s.id).ToList().Contains(course.courseId)).FirstOrDefault();
|
|
|
+ if(examRelated != null) course.examId = examRelated.id;
|
|
|
+ }
|
|
|
jointEventGroup.Add(jointEventGroupRow);
|
|
|
}
|
|
|
}
|
|
@@ -732,9 +755,10 @@ namespace TEAMModelOS.Controllers.Common
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
|
|
|
//整理 jointExamInfo
|
|
|
- if(jointExamInfo.Count > 0)
|
|
|
+ if (jointExamInfo.Count > 0)
|
|
|
{
|
|
|
foreach(JointExam jointExam in jointExamInfo)
|
|
|
{
|
|
@@ -751,6 +775,7 @@ namespace TEAMModelOS.Controllers.Common
|
|
|
stuListRow.creatorId = stu.creatorId;
|
|
|
stuListRow.creatorName = stu.creatorName;
|
|
|
stuListRow.courseLists = stu.courseLists;
|
|
|
+
|
|
|
jointExam.stuLists.Add(stuListRow);
|
|
|
}
|
|
|
}
|