CrazyIter_Bin 3 lat temu
rodzic
commit
cfa42d1286
1 zmienionych plików z 31 dodań i 4 usunięć
  1. 31 4
      TEAMModelOS.FunctionV4/CosmosDB/TriggerSurvey.cs

+ 31 - 4
TEAMModelOS.FunctionV4/CosmosDB/TriggerSurvey.cs

@@ -110,6 +110,15 @@ namespace TEAMModelOS.FunctionV4
                             {
                                 addTmdidsCls.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classLists.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x.id)&& y.type==1) 
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     tmdActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -128,7 +137,7 @@ namespace TEAMModelOS.FunctionV4
                                         owner = survey.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = classes
+                                        classIds = classIds.ToList()
                                     });
                                 });
                             }
@@ -136,6 +145,15 @@ namespace TEAMModelOS.FunctionV4
                             {
                                 addStudentsCls.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classLists.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x.id)&& y.code.Equals(survey.school) && y.type == 2)
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     stuActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -154,8 +172,8 @@ namespace TEAMModelOS.FunctionV4
                                         owner = survey.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = classes
-                                    });
+                                        classIds = classIds.ToList()
+                                    }); 
                                 });
                             }
                             (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetStutmdidListids(client, _dingDing, survey.tchLists, survey.school, ps);
@@ -172,6 +190,15 @@ namespace TEAMModelOS.FunctionV4
                                 }
                                 tchList.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classInfos.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x.id)  && y.type == 1)
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     tchActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -190,7 +217,7 @@ namespace TEAMModelOS.FunctionV4
                                         owner = survey.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = survey.tchLists
+                                        classIds = classIds.ToList()
                                     });
                                 });