CrazyIter_Bin 3 years ago
parent
commit
5b45c8a9b4
1 changed files with 9 additions and 6 deletions
  1. 9 6
      TEAMModelBI/Controllers/OpenApi/CourseController.cs

+ 9 - 6
TEAMModelBI/Controllers/OpenApi/CourseController.cs

@@ -514,12 +514,15 @@ namespace TEAMModelAPI.Controllers
             }
             }
 
 
             List<GroupListDto> groupListDtos= await GroupListService.GetGroupListListids(_azureCosmos.GetCosmosClient(), _dingDing, groupIds, school);
             List<GroupListDto> groupListDtos= await GroupListService.GetGroupListListids(_azureCosmos.GetCosmosClient(), _dingDing, groupIds, school);
-            IEnumerable<string> unexistGroupIds = groupIds.Except(groupListDtos.Select(x=>x.id));
-            //移除不存在的名单id
-            import_schedules_hastime.RemoveAll(x => unexistGroupIds.Contains(x.classId));
-            import_schedules_hastime.RemoveAll(x => unexistGroupIds.Contains(x.stulist));
-            import_schedules_nottime.RemoveAll(x => unexistGroupIds.Contains(x.classId));
-            import_schedules_nottime.RemoveAll(x => unexistGroupIds.Contains(x.stulist));
+            IEnumerable<string> unexistGroupIds = null;
+            if (groupListDtos.IsNotEmpty()) {
+                unexistGroupIds = groupIds.Except(groupListDtos.Select(x => x.id));
+                //移除不存在的名单id
+                import_schedules_hastime.RemoveAll(x => unexistGroupIds.Contains(x.classId));
+                import_schedules_hastime.RemoveAll(x => unexistGroupIds.Contains(x.stulist));
+                import_schedules_nottime.RemoveAll(x => unexistGroupIds.Contains(x.classId));
+                import_schedules_nottime.RemoveAll(x => unexistGroupIds.Contains(x.stulist));
+            }
 
 
             HashSet<Course> update_course = new HashSet<Course>();
             HashSet<Course> update_course = new HashSet<Course>();
             HashSet<string> unexistTimeIds = new HashSet<string>();
             HashSet<string> unexistTimeIds = new HashSet<string>();