Bladeren bron

Function调整

zhouj1203@hotmail.com 3 jaren geleden
bovenliggende
commit
35e7478f6e

+ 1 - 1
TEAMModelFunction/TriggerExam.cs

@@ -131,7 +131,7 @@ namespace TEAMModelFunction
                                     {
                                         pk = "Activity",
                                         id = info.id,
-                                        code = $"Activity-{info.school}-{x.id}",
+                                        code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
                                         type = "Exam",
                                         name = info.name,
                                         startTime = info.startTime,

+ 1 - 1
TEAMModelFunction/TriggerSurvey.cs

@@ -111,7 +111,7 @@ namespace TEAMModelFunction
                                     {
                                         pk = "Activity",
                                         id = survey.id,
-                                        code = $"Activity-{survey.school}-{x.id}",
+                                        code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
                                         type = "Survey",
                                         name = survey.name,
                                         startTime = survey.startTime,

+ 1 - 1
TEAMModelFunction/TriggerVote.cs

@@ -116,7 +116,7 @@ namespace TEAMModelFunction
                                     {
                                         pk = "Activity",
                                         id = vote.id,
-                                        code = $"Activity-{vote.school}-{x.id}",
+                                        code = $"Activity-{x.code.Replace("Base-","")}-{x.id}",
                                         type = "Vote",
                                         name = vote.name,
                                         startTime = vote.startTime,

+ 9 - 2
TEAMModelOS.SDK/Models/Service/TriggerStuActivity.cs

@@ -388,13 +388,20 @@ namespace TEAMModelFunction
                 }
                 if (studentss.IsNotEmpty()) {
                     List<string> inidstus = new List<string>();
-                    studentss.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
+                    foreach (Students stu in studentss) {
+                        var querystu = $"SELECT  c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id = '{stu.id}'";
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{stu.code}") }))
+                        {
+                            stuInfos.Add(item);
+                        }
+                    }
+                    /*studentss.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
                     var insqlstu = string.Join(",", inidstus);
                     var querystu = $"SELECT  c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
                     await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{school}") }))
                     {
                         stuInfos.Add(item);
-                    }
+                    }*/
                 }
                 students.ForEach(x =>
                 {