CrazyIter_Bin 3 年之前
父节点
当前提交
d141c03baf
共有 1 个文件被更改,包括 63 次插入38 次删除
  1. 63 38
      TEAMModelOS.SDK/Models/Service/StatisticsService.cs

+ 63 - 38
TEAMModelOS.SDK/Models/Service/StatisticsService.cs

@@ -177,25 +177,40 @@ namespace TEAMModelOS.SDK
         }
         }
         public static async Task<TeacherTrain> DoActivity(TeacherTrain train, AreaSetting setting, Area area, CosmosClient client, string _school, string _tmdid) {
         public static async Task<TeacherTrain> DoActivity(TeacherTrain train, AreaSetting setting, Area area, CosmosClient client, string _school, string _tmdid) {
             //问卷调查
             //问卷调查
+            int surveyJoin=0;
+            int voteJoin = 0;
+            int examJoin = 0;
+            int surveyDone = 0;
+            int voteDone = 0;
+            int examDone = 0;
+            int surveyAreaJoin = 0;
+            int voteAreaJoin = 0;
+            int examAreaJoin = 0;
+            int surveyAreaDone = 0;
+            int voteAreaDone = 0;
+            int examAreaDone = 0;
+
+
+
             await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher")
             await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher")
-             .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Survey' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
+                     .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Survey' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
             {
             {
                 if (!string.IsNullOrEmpty(item.owner))
                 if (!string.IsNullOrEmpty(item.owner))
                 {
                 {
                     if (item.owner.Equals("school"))
                     if (item.owner.Equals("school"))
                     {
                     {
-                        train.surveyJoin += 1;
+                        surveyJoin += 1;
                         if (item.taskStatus > 0)
                         if (item.taskStatus > 0)
                         {
                         {
-                            train.surveyDone += 1;
+                            surveyDone += 1;
                         }
                         }
                     }
                     }
                     else if (item.owner.Equals("area"))
                     else if (item.owner.Equals("area"))
                     {
                     {
-                        train.surveyAreaJoin += 1;
+                        surveyAreaJoin += 1;
                         if (item.taskStatus > 0)
                         if (item.taskStatus > 0)
                         {
                         {
-                            train.surveyAreaDone += 1;
+                            surveyAreaDone += 1;
                         }
                         }
                     }
                     }
                 }
                 }
@@ -208,18 +223,18 @@ namespace TEAMModelOS.SDK
                 {
                 {
                     if (item.owner.Equals("school"))
                     if (item.owner.Equals("school"))
                     {
                     {
-                        train.examJoin += 1;
+                        examJoin += 1;
                         if (item.taskStatus > 0)
                         if (item.taskStatus > 0)
                         {
                         {
-                            train.examDone += 1;
+                            examDone += 1;
                         }
                         }
                     }
                     }
                     else if (item.owner.Equals("area"))
                     else if (item.owner.Equals("area"))
                     {
                     {
-                        train.examAreaJoin += 1;
+                        examAreaJoin += 1;
                         if (item.taskStatus > 0)
                         if (item.taskStatus > 0)
                         {
                         {
-                            train.examAreaDone += 1;
+                            examAreaDone += 1;
                         }
                         }
                     }
                     }
                 }
                 }
@@ -232,22 +247,34 @@ namespace TEAMModelOS.SDK
                 {
                 {
                     if (item.owner.Equals("school"))
                     if (item.owner.Equals("school"))
                     {
                     {
-                        train.voteJoin += 1;
+                        voteJoin += 1;
                         if (item.taskStatus > 0)
                         if (item.taskStatus > 0)
                         {
                         {
-                            train.voteDone += 1;
+                            voteDone += 1;
                         }
                         }
                     }
                     }
                     else if (item.owner.Equals("area"))
                     else if (item.owner.Equals("area"))
                     {
                     {
-                        train.voteAreaJoin += 1;
+                        voteAreaJoin += 1;
                         if (item.taskStatus > 0)
                         if (item.taskStatus > 0)
                         {
                         {
-                            train.voteAreaDone += 1;
+                            voteAreaDone += 1;
                         }
                         }
                     }
                     }
                 }
                 }
             }
             }
+            train.surveyJoin = surveyJoin;
+            train.voteJoin = voteJoin;
+            train.examJoin = examJoin;
+            train.surveyDone = surveyDone;
+            train.voteDone = voteDone;
+            train.examDone = examDone;
+            train.surveyAreaJoin = surveyAreaJoin;
+            train.voteAreaJoin = voteAreaJoin;
+            train.examAreaJoin = examAreaJoin;
+            train.surveyAreaDone = surveyAreaDone;
+            train.voteAreaDone = voteAreaDone;
+            train.examAreaDone = examAreaDone;
             return train;
             return train;
         }
         }
         
         
@@ -419,42 +446,42 @@ namespace TEAMModelOS.SDK
                 abilities.Add(item);
                 abilities.Add(item);
 
 
             }
             }
-            List<TeacherAility> teacherAilities= new List<TeacherAility>();
-            List<TeacherAility> teacherAilitiesAll = new List<TeacherAility>();
+            Currency currency= new Currency();
+            Currency currencyAll = new Currency();
             abilitySubs.ForEach(item => {
             abilitySubs.ForEach(item => {
-                int currency = item.from == 1 ? 1 : 0;
+                int currencyInt = item.from == 1 ? 1 : 0;
                 Ability ability = abilities.Find(x=>x.id.Equals(item.id));
                 Ability ability = abilities.Find(x=>x.id.Equals(item.id));
                 if (ability != null)
                 if (ability != null)
                 {
                 {
-                    currency = item.from == 0 ? ability.currency : 1;
+                    currencyInt = item.from == 0 ? ability.currency : 1;
                 }
                 }
                 else
                 else
                 {
                 {
-                    currency = 0;
+                    currencyInt = 0;
                 }
                 }
                 if (item.uploads.IsNotEmpty())
                 if (item.uploads.IsNotEmpty())
                 {
                 {
-                    if (currency == 1)
+                    if (currencyInt == 1)
                     {
                     {
-                        train.currency.uploadDone += item.uploads.Count;
+                       currency.uploadDone += item.uploads.Count;
                     }
                     }
-                    train.currencyAll.uploadDone += item.uploads.Count;
+                    currencyAll.uploadDone += item.uploads.Count;
                 }
                 }
                 if (item.exerciseScore > 0)
                 if (item.exerciseScore > 0)
                 {
                 {
-                    if (currency == 1)
+                    if (currencyInt == 1)
                     {
                     {
-                        train.currency.exerciseAbility += 1;
-                        train.currency.learnAbility += item.abilityCount;
+                         currency.exerciseAbility += 1;
+                        currency.learnAbility += item.abilityCount;
                     }
                     }
-                    train.currencyAll.exerciseAbility += 1;
-                    train.currencyAll.learnAbility += item.abilityCount;
+                    currencyAll.exerciseAbility += 1;
+                    currencyAll.learnAbility += item.abilityCount;
                 }
                 }
                 List<TeacherHprecord> hprecords = new List<TeacherHprecord>();
                 List<TeacherHprecord> hprecords = new List<TeacherHprecord>();
                 TeacherAility teacherAility = new Models.TeacherAility
                 TeacherAility teacherAility = new Models.TeacherAility
                 {
                 {
                     id = ability.id,
                     id = ability.id,
-                    currency = currency,
+                    currency = currencyInt,
                     no = ability.no,
                     no = ability.no,
                     name = ability.name,
                     name = ability.name,
                     dimension = ability.dimension,
                     dimension = ability.dimension,
@@ -526,20 +553,18 @@ namespace TEAMModelOS.SDK
                         teacherAility.hprecord.AddRange(hprecord);
                         teacherAility.hprecord.AddRange(hprecord);
                     }
                     }
                 }
                 }
-                if (currency == 1)
+                if (currencyInt == 1)
                 {
                 {
-                    train.currency.subCount += 1;
-                    train.currency.uploadTotal += ability.stds.FindAll(x => x.task.IsNotEmpty()).Select(y => y.task).Count();
-                    teacherAilities.Add(teacherAility);
-                    //train.currency.teacherAilities.Add(teacherAility);
+                     currency.subCount += 1;
+                   currency.uploadTotal += ability.stds.FindAll(x => x.task.IsNotEmpty()).Select(y => y.task).Count();
+                     currency.teacherAilities.Add(teacherAility);
                 }
                 }
-                train.currencyAll.subCount += 1;
-                train.currencyAll.uploadTotal += ability.stds.FindAll(x => x.task.IsNotEmpty()).Select(y => y.task).Count();
-                teacherAilitiesAll.Add(teacherAility);
-                //train.currencyAll.teacherAilities.Add(teacherAility);
+                currencyAll.subCount += 1;
+                currencyAll.uploadTotal += ability.stds.FindAll(x => x.task.IsNotEmpty()).Select(y => y.task).Count();
+                currencyAll.teacherAilities.Add(teacherAility);
             });
             });
-            train.currency.teacherAilities = teacherAilities;
-            train.currencyAll.teacherAilities = teacherAilitiesAll;
+            train.currency = currency;
+            train.currencyAll = currencyAll;
             //如果总分钟数超过20学时,则直接复制20学时。
             //如果总分钟数超过20学时,则直接复制20学时。
             var videoTime = (int)train.currency.videoTime / setting.lessonMinutes;
             var videoTime = (int)train.currency.videoTime / setting.lessonMinutes;
             train.onlineTime = videoTime > setting.onlineTime ? setting.onlineTime:videoTime;
             train.onlineTime = videoTime > setting.onlineTime ? setting.onlineTime:videoTime;