Forráskód Böngészése

1.統測活動程序追加熱身賽結束後計算決賽名單
2.閱卷模式篩選結束時間變更為行程結束後+4天
3.手動建立個人統測評量追加篩選TMID邏輯

jeff 8 hónapja
szülő
commit
4b1720ac22

+ 13 - 0
TEAMModelOS.Function/IESServiceBusTrigger.cs

@@ -3244,6 +3244,19 @@ namespace TEAMModelOS.Function
                                 }
                                 break;
                             case "finish":
+                                //熱身賽結束,生成決賽名單
+                                if (jointEventSchedule.type.Equals("exam") && jointEventSchedule.examType.Equals("regular"))
+                                {
+                                    List<string> jointGroupIds = jointEvent.groups.Select(g => g.id).ToList();
+                                    if (jointGroupIds.Count > 0)
+                                    {
+                                        string scope = "private";
+                                        foreach (string jointGroupId in jointGroupIds)
+                                        {
+                                            List<JointEventGroupDb> addResult = await JointService.CreatePassJointCourseBySchedule(client, jointEvent.id, jointGroupId, jointEventSchedule.id, scope);
+                                        }
+                                    }
+                                }
                                 break;
                         }
                     }

+ 5 - 4
TEAMModelOS/Controllers/Teacher/JointEventController.cs

@@ -193,7 +193,7 @@ namespace TEAMModelOS.Controllers.Common
                 {
                     if (!string.IsNullOrWhiteSpace(tmid))
                     {
-                        StringBuilder stringBuilderSelectM = new($"SELECT DISTINCT VALUE c.id FROM c JOIN s IN c.schedule JOIN g IN c.groups WHERE s.startTime <= {now} AND s.endTime > {now} AND s.type = 'exam' AND array_contains(g.assistants,'{tmid}') ");
+                        StringBuilder stringBuilderSelectM = new($"SELECT DISTINCT VALUE c.id FROM c JOIN s IN c.schedule JOIN g IN c.groups WHERE s.startTime <= {now} AND (s.endTime + 345600000) > {now} AND s.type = 'exam' AND array_contains(g.assistants,'{tmid}') "); //閱卷結束時間為行程結束+4天
                         StringBuilder sqlM = stringBuilderSelectM.Append(stringBuilderWhere);
                         await foreach (string item in client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIteratorSql<string>(queryText: sqlM.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"JointEvent") }))
                         {
@@ -1352,7 +1352,7 @@ namespace TEAMModelOS.Controllers.Common
             return result;
         }
 
-
+        //生成決賽名單
         [ProducesDefaultResponseType]
 #if !DEBUG
         [Authorize(Roles = "IES")]
@@ -1364,7 +1364,7 @@ namespace TEAMModelOS.Controllers.Common
             List<JointEventGroupDb> result = new List<JointEventGroupDb>();
             var client = _azureCosmos.GetCosmosClient();
             string jointEventId = (request.TryGetProperty("jointEventId", out JsonElement _jointEventId)) ? _jointEventId.ToString() : string.Empty;
-            string jointScheduleId = (request.TryGetProperty("jointScheduleId", out JsonElement _jointScheduleId)) ? _jointScheduleId.ToString() : string.Empty; //要計算的行程
+            string jointScheduleId = (request.TryGetProperty("jointScheduleId", out JsonElement _jointScheduleId)) ? _jointScheduleId.ToString() : string.Empty; //要計算的熱身賽行程
             string scope = "private";
             JointEvent jointEvent = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<JointEvent>(jointEventId, new PartitionKey("JointEvent"));
             if (jointEvent == null)
@@ -1491,6 +1491,7 @@ namespace TEAMModelOS.Controllers.Common
             string jointEventId = (request.TryGetProperty("jointEventId", out JsonElement _jointEventId)) ? _jointEventId.ToString() : string.Empty;
             string jointScheduleId = (request.TryGetProperty("jointScheduleId", out JsonElement _jointScheduleId)) ? _jointScheduleId.ToString() : string.Empty;
             string jointExamId = (request.TryGetProperty("jointExamId", out JsonElement _jointExamId)) ? _jointExamId.ToString() : string.Empty;
+            string tmid = (request.TryGetProperty("tmid", out JsonElement _tmid)) ? _tmid.ToString() : string.Empty;
             if (string.IsNullOrWhiteSpace(jointEventId) || string.IsNullOrWhiteSpace(jointScheduleId))
             {
                 return BadRequest();
@@ -1541,7 +1542,7 @@ namespace TEAMModelOS.Controllers.Common
                 foreach (var info in jointExams)
                 {
                     //生成統測活動所有的個人評量
-                    await JointService.GenerateExamFromJointExamAsync(client, _azureStorage, _serviceBus, _coreAPIHttpService, _azureRedis, _configuration, _dingDing, info, string.Empty);
+                    await JointService.GenerateExamFromJointExamAsync(client, _azureStorage, _serviceBus, _coreAPIHttpService, _azureRedis, _configuration, _dingDing, info, tmid);
                 }
             }