CrazyIter_Bin 3 年之前
父节点
当前提交
5b45c8a9b4
共有 1 个文件被更改,包括 9 次插入6 次删除
  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);
-            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<string> unexistTimeIds = new HashSet<string>();