CrazyIter_Bin %!s(int64=3) %!d(string=hai) anos
pai
achega
c192460d6b
Modificáronse 1 ficheiros con 11 adicións e 4 borrados
  1. 11 4
      TEAMModelOS.SDK/Models/Service/StatisticsService.cs

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

@@ -419,7 +419,7 @@ namespace TEAMModelOS.SDK
             //线下 学校研修活动
             List<StuActivity> activities = new List<StuActivity>();
             await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher")
-            .GetItemQueryIterator<StuActivity>(queryText: $"select value(c) from c where  c.type = 'Study' and c.owner<>'area' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
+            .GetItemQueryIterator<StuActivity>(queryText: $"select value(c) from c where  c.type = 'Study' and c.owner<>'area' and c.school='{_school}' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
             {
                 activities.Add(item);
             }
@@ -428,11 +428,11 @@ namespace TEAMModelOS.SDK
                 studies = new List<Study>();
                 if (activities.IsNotEmpty())
                 {
-                    insql = $" where c.owner<>'area' and  c.id in ({string.Join(",", activities.Select(o => $"'{o.id}'"))})";
+                    insql = $" where  c.id in ({string.Join(",", activities.Select(o => $"'{o.id}'"))})";
 
                 }
                 await foreach (var item in client.GetContainer("TEAMModelOS", "Common")
-                .GetItemQueryIterator<Study>(queryText: $"select value(c) from c {insql} ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Study-{_school}") }))
+                .GetItemQueryIterator<Study>(queryText: $"select value(c) from c {insql} and c.owner<>'area'   ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Study-{_school}") }))
                 {
                     studies.Add(item);
                 }
@@ -461,6 +461,9 @@ namespace TEAMModelOS.SDK
             
             List<OfflineRecord> offlines = new List<OfflineRecord>();
             activities.ForEach(item => {
+                if (item.id.Equals("c974b96d-cdf6-48d5-9074-8c1a02d2cac5")) {
+                    Console.WriteLine(item.id);
+                }
                 Study study = studies.Find(y => y.id.Equals(item.id));
                 if (study != null) {
                     StudyRecord studyRecord = studyRecords.Find(y => y.id.Equals(item.id));
@@ -498,10 +501,14 @@ namespace TEAMModelOS.SDK
                                     record.score = -1;
                                 }
                             }
-                            else { 
+                            else
+                            {
 
                             }
                         }
+                        else { 
+                            
+                        }
                     }
                     else
                     {