浏览代码

补全。

CrazyIter_Bin 3 年之前
父节点
当前提交
d62afc8efd

+ 13 - 4
TEAMModelOS.SDK/Models/Service/StatisticsService.cs

@@ -64,7 +64,9 @@ namespace TEAMModelOS.SDK
                 }
                 List<Task<ItemResponse<TeacherTrain>>> task = new List<Task<ItemResponse<TeacherTrain>>>();
                 teacherTrains.ForEach(x => {
-                    x.update.UnionWith(change.update);
+                    change.update.ToList().ForEach(u => {
+                        x.update.Add(u);
+                    });
                     task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<TeacherTrain>(x, x.id, new PartitionKey($"TeacherTrain-{change.school}")));
                 });
                 await task.TaskPage(50);
@@ -83,7 +85,9 @@ namespace TEAMModelOS.SDK
                             update = new HashSet<string> {  StatisticsService.TeacherAbility,
                         StatisticsService.TeacherClass, StatisticsService.OfflineRecord }
                         };
-                        teacherTrain.update.UnionWith(change.update);
+                        change.update.ToList().ForEach(u => {
+                            teacherTrain.update.Add(u);
+                        }); 
                         task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync<TeacherTrain>(teacherTrain, new PartitionKey($"TeacherTrain-{change.school}")));
                     });
                     await task.TaskPage(100);
@@ -105,7 +109,9 @@ namespace TEAMModelOS.SDK
                 }
                 List<Task<ItemResponse<TeacherTrain>>> task = new List<Task<ItemResponse<TeacherTrain>>>();
                 teacherTrains.ForEach(x => {
-                    x.update.UnionWith(list.update);
+                    list.update.ForEach(u => {
+                        x.update.Add(u);
+                    });
                     task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<TeacherTrain>(x, x.id, new PartitionKey($"TeacherTrain-{list.school}")));
                 });
                 await task.TaskPage(50);
@@ -124,7 +130,10 @@ namespace TEAMModelOS.SDK
                             update = new HashSet<string> {  StatisticsService.TeacherAbility,
                         StatisticsService.TeacherClass, StatisticsService.OfflineRecord }
                         };
-                        teacherTrain.update.UnionWith(list.update);
+                        list.update.ForEach(u => {
+                            teacherTrain.update.Add(u);
+                        });
+                       
                         task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").UpsertItemAsync<TeacherTrain>(teacherTrain, new PartitionKey($"TeacherTrain-{list.school}")));
                     });
                     await task.TaskPage(100);

+ 8 - 5
TEAMModelOS/Controllers/Normal/AbilityStatisticsController.cs

@@ -270,22 +270,25 @@ namespace TEAMModelOS.Controllers
                         x.school,
                         x.id,
                         x.totalTime,
-                        currency =new {
+                        currency = new {
                             x.currency.submitTime,
                             x.currency.exerciseAbility,
                             x.currency.learnAbility,
                             x.currency.uploadDone,
                             x.currency.uploadTotal,
                             x.currency.videoTime,
-                            teacherAilities= x.currency.teacherAilities.Select(t => new {
+                            teacherAilities = x.currency.teacherAilities.Select(t => new {
                                 t.onlineTime,
                                 t.videoTime,
                                 t.no,
                                 t.name,
                                 t.dimension,
-                                t.zpscore,t.xzscore,t.hpscore
-                            })
-                        } 
+                                t.zpscore, t.xzscore, t.hpscore
+                            }),
+                            offlineCountNo=  x.offlineRecords.Where(o => o.upload==0).Count(),
+                            offlineCountOk = x.offlineRecords.Where(o => o.upload == 1).Count()
+                        },
+                        teacherClasseCount = x.teacherClasses.Count
                     };
                     dynamics.Add(dynamic);
                 });