소스 검색

修改问卷题目记录的存储问卷为record.json中。

CrazyIter_Bin 4 년 전
부모
커밋
003519e04b
2개의 변경된 파일10개의 추가작업 그리고 84개의 파일을 삭제
  1. 9 45
      TEAMModelFunction/TriggerSurvey.cs
  2. 1 39
      TEAMModelFunction/TriggerVote.cs

+ 9 - 45
TEAMModelFunction/TriggerSurvey.cs

@@ -83,45 +83,6 @@ namespace TEAMModelFunction
                         }
                         break;
                     case "going":
-                        //if (survey.scope == "school")
-                        //{
-                        //    data = new ActivityData
-                        //    {
-                        //        id = survey.id,
-                        //        code = $"Activity-{survey.school}",
-                        //        type = "survey",
-                        //        name = survey.name,
-                        //        startTime = survey.startTime,
-                        //        endTime = survey.endTime,
-                        //        scode = survey.code,
-                        //        scope = survey.scope,
-                        //        classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
-                        //        tmdids = survey.tmdids.IsNotEmpty() ? survey.tmdids : new List<string> { "" },
-                        //        progress = "going",
-                        //        subjects = new List<string> { "" }
-                        //    };
-                        //    await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
-                        //}
-                        //else if (survey.scope == "private")
-                        //{
-                        //    data = new ActivityData
-                        //    {
-                        //        id = survey.id,
-                        //        code = $"Activity-Common",
-                        //        type = "survey",
-                        //        name = survey.name,
-                        //        startTime = survey.startTime,
-                        //        endTime = survey.endTime,
-                        //        scode = survey.code,
-                        //        scope = survey.scope,
-                        //        progress = "going",
-                        //        classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
-                        //        tmdids = new List<string> { "" },
-                        //        subjects = new List<string> { "" }
-                        //    };
-                        //    await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
-                        //}
-
                         (List<string> tmdids,List<Students> students) =   await TriggerStuActivity. GetStuList(client, survey.classes, survey.school);
                         await _dingDing.SendBotMsg($"问卷调查{tdata.id}写入学生表作为活动列表!", GroupNames.成都开发測試群組);
                         List<StuActivity> stuActivities = new List<StuActivity>();
@@ -208,12 +169,11 @@ namespace TEAMModelFunction
                             var value = submit.ToString();
                             userids.Add(value);
                         }
-                        var cods = new { records = recs, userids };
-                        //问卷整体情况
-                        await _azureStorage.UploadFileByContainer(blobcntr, cods.ToJsonString(), "survey", $"{survey.id}/record.json");
+
+                        List<QuestionRecord> questionRecords = new List<QuestionRecord>();
                         //结算每道题的答题情况
                         var ContainerClient =  _azureStorage.GetBlobContainerClient(blobcntr);
-                        List<Task<string>> tasks = new List<Task<string>>();
+                        //List<Task<string>> tasks = new List<Task<string>>();
                         //获取
                         try {
                             List<string> items = await ContainerClient.List($"survey/{survey.id}/urecord");
@@ -264,12 +224,16 @@ namespace TEAMModelFunction
                                         }
                                     }
                                 }
-                                tasks.Add(  _azureStorage.UploadFileByContainer(blobcntr, question.ToJsonString(), "survey", url));
+                                questionRecords.Add(question);
+                                //tasks.Add(  _azureStorage.UploadFileByContainer(blobcntr, question.ToJsonString(), "survey", url));
                             }
-                            await Task.WhenAll(tasks);
+                           // await Task.WhenAll(tasks);
                         } catch (Exception ex) {
                             await _dingDing.SendBotMsg($"问卷调查问题结算异常{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
                         }
+                        var cods = new { records = recs, userids, question= questionRecords };
+                        //问卷整体情况
+                        await _azureStorage.UploadFileByContainer(blobcntr, cods.ToJsonString(), "survey", $"{survey.id}/record.json");
                         if (string.IsNullOrEmpty(survey.recordUrl))
                         {
                             survey.recordUrl = $"/survey/{survey.id}/record.json";

+ 1 - 39
TEAMModelFunction/TriggerVote.cs

@@ -86,45 +86,7 @@ namespace TEAMModelFunction
                         }
                         break;
                     case "going":
-                        //if (vote.scope == "school")
-                        //{
-                        //    data = new ActivityData
-                        //    {
-                        //        id = vote.id,
-                        //        code = $"Activity-{vote.school}",
-                        //        type = "vote",
-                        //        name = vote.name,
-                        //        startTime = vote.startTime,
-                        //        endTime = vote.endTime,
-                        //        scode = vote.code,
-                        //        scope = vote.scope,
-                        //        classes = vote.classes.IsNotEmpty() ? vote.classes : new List<string> { "" },
-                        //        tmdids = vote.tmdids.IsNotEmpty() ? vote.tmdids : new List<string> { "" },
-                        //        progress = "going",
-                        //        subjects = new List<string> { "" }
-                        //    };
-                        //    await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
-                        //}
-                        //else if (vote.scope == "private")
-                        //{
-                        //    data = new ActivityData
-                        //    {
-                        //        id = vote.id,
-                        //        code = $"Activity-Common",
-                        //        type = "vote",
-                        //        name = vote.name,
-                        //        startTime = vote.startTime,
-                        //        endTime = vote.endTime,
-                        //        scode = vote.code,
-                        //        scope = vote.scope,
-                        //        progress = "going",
-                        //        classes = vote.classes.IsNotEmpty() ? vote.classes : new List<string> { "" },
-                        //        tmdids = new List<string> { "" },
-                        //        subjects = new List<string> { "" }
-                        //    };
-                        //    await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
-                        //}
-
+                        
                         (List<string> tmdids, List<Students> students) = await TriggerStuActivity.GetStuList(client, vote.classes, vote.school);
                         List<string> tmds = vote.tmdids.IsNotEmpty() ? vote.tmdids : new List<string>() ;
                         if (tmdids.IsNotEmpty()) {