|
@@ -1915,7 +1915,8 @@ namespace TEAMModelOS.Controllers.Both
|
|
|
List<KeyValuePair<string,CourseTask >> privateAssistantTask = new List<KeyValuePair<string,CourseTask >>();
|
|
|
List<CourseDto> schoolCourses = new List<CourseDto>();
|
|
|
List<CourseDto> teahcerCourses = new List<CourseDto>();
|
|
|
- if (!string.IsNullOrWhiteSpace(school)) {
|
|
|
+ if (!string.IsNullOrWhiteSpace(school))
|
|
|
+ {
|
|
|
School schoolBase = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>(school, new PartitionKey("Base"));
|
|
|
JsonElement _year = default, _semesterId = default, _periodId = default;
|
|
|
if (!request.TryGetProperty("periodId", out _periodId)) return BadRequest();
|
|
@@ -2003,28 +2004,29 @@ namespace TEAMModelOS.Controllers.Both
|
|
|
privateAssistantTask.Add(new KeyValuePair<string, CourseTask>(x.courseId, courseTask));
|
|
|
}
|
|
|
});
|
|
|
- if (courseIds.Any())
|
|
|
+
|
|
|
+ }
|
|
|
+ if (courseIds.Any())
|
|
|
+ {
|
|
|
+ string sqlCourse = $"select value c from c where c.id in ({string.Join(",", courseIds.Select(b => $"'{b}'"))})";
|
|
|
+ var result = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetList<CourseBase>(sqlCourse, $"CourseBase-{tmdid}");
|
|
|
+ if (result.list.IsNotEmpty())
|
|
|
{
|
|
|
- string sqlCourse = $"select value c from c where c.id in ({string.Join(",", courseIds.Select(b => $"'{b}'"))})";
|
|
|
- var result = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<CourseBase>(sqlCourse, $"CourseBase");
|
|
|
- if (result.list.IsNotEmpty())
|
|
|
- {
|
|
|
- foreach (var item in result.list)
|
|
|
+ foreach (var item in result.list)
|
|
|
|
|
|
+ {
|
|
|
+ List<CourseTaskDto> courseTaskDtos = new List<CourseTaskDto>();
|
|
|
+ var teacher = privateTeacherTask.Where(x => x.Key.Equals(item.id)).Select(z => new CourseTaskDto { courseTask=z.Value, type="teacher" });
|
|
|
+ if (teacher.Any())
|
|
|
{
|
|
|
- List<CourseTaskDto> courseTaskDtos = new List<CourseTaskDto>();
|
|
|
- var teacher = privateTeacherTask.Where(x => x.Key.Equals(item.id)).Select(z => new CourseTaskDto { courseTask=z.Value, type="teacher" });
|
|
|
- if (teacher.Any())
|
|
|
- {
|
|
|
- courseTaskDtos.AddRange(teacher.ToList());
|
|
|
- }
|
|
|
- var assistant = privateAssistantTask.Where(x => x.Key.Equals(item.id)).Select(z => new CourseTaskDto { courseTask=z.Value, type="assistant" });
|
|
|
- if (assistant.Any())
|
|
|
- {
|
|
|
- courseTaskDtos.AddRange(assistant.ToList());
|
|
|
- }
|
|
|
- teahcerCourses.Add(new CourseDto { courseBase=item, courseTasks=courseTaskDtos });
|
|
|
+ courseTaskDtos.AddRange(teacher.ToList());
|
|
|
+ }
|
|
|
+ var assistant = privateAssistantTask.Where(x => x.Key.Equals(item.id)).Select(z => new CourseTaskDto { courseTask=z.Value, type="assistant" });
|
|
|
+ if (assistant.Any())
|
|
|
+ {
|
|
|
+ courseTaskDtos.AddRange(assistant.ToList());
|
|
|
}
|
|
|
+ teahcerCourses.Add(new CourseDto { courseBase=item, courseTasks=courseTaskDtos });
|
|
|
}
|
|
|
}
|
|
|
}
|