|
@@ -128,7 +128,7 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
if (cos.scope.Equals("school"))
|
|
|
{
|
|
|
- Course course;
|
|
|
+ Course course = new();
|
|
|
try
|
|
|
{
|
|
|
course = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<Course>(cos.id, new Azure.Cosmos.PartitionKey(cos.scode));
|
|
@@ -138,7 +138,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Course course;
|
|
|
+ Course course = new();
|
|
|
try
|
|
|
{
|
|
|
course = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<Course>(cos.id, new Azure.Cosmos.PartitionKey(cos.scode));
|
|
@@ -151,13 +151,21 @@ namespace TEAMModelOS.Controllers
|
|
|
HashSet<string> info = new HashSet<string>();
|
|
|
foreach (CourseDto dto in sc)
|
|
|
{
|
|
|
- foreach (Schedule schedule in dto.course.schedule)
|
|
|
+ if(dto.course != null)
|
|
|
{
|
|
|
- if (!string.IsNullOrEmpty(schedule.teacherId))
|
|
|
+ if (dto.course.schedule.Count > 0)
|
|
|
{
|
|
|
- info.Add(schedule.teacherId);
|
|
|
+ foreach (Schedule schedule in dto.course.schedule)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(schedule.teacherId))
|
|
|
+ {
|
|
|
+ info.Add(schedule.teacherId);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
List<(string id, string name)> teachers = new();
|
|
@@ -205,7 +213,7 @@ namespace TEAMModelOS.Controllers
|
|
|
},
|
|
|
s.stuCourse
|
|
|
});
|
|
|
- return Ok(new { courses = sc });
|
|
|
+ return Ok(new { courses });
|
|
|
}
|
|
|
}
|
|
|
public class CourseDto
|