Prechádzať zdrojové kódy

调整学情部分查询内容

zhouj1203@hotmail.com 3 rokov pred
rodič
commit
56c4461692

+ 19 - 4
TEAMModelOS/Controllers/Analysis/AnalysisController.cs

@@ -152,12 +152,24 @@ namespace TEAMModelOS.Controllers.Analysis
                 }
                 //获取本次评测所有班级作答结果
                 List<ExamClassResult> examClassResults = new List<ExamClassResult>();
-                var queryClass = $"select c.id,c.name,c.subjectId,c.studentScores,c.studentIds,c.gradeId,c.info,c.standard,c.krate,c.phc,c.plc,c.pc,c.frate,c.fphc,c.fplc,c.fpc from c where c.examId =  '{id}' and c.progress = true ";
-                await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamClassResult>(queryText: queryClass, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamClassResult-{code}") }))
+                if (info.owner.Equals("teacher"))
                 {
-                    examClassResults.Add(item);
+                    var queryClass = $"select c.id,c.name,c.subjectId,c.studentScores,c.studentIds,c.gradeId,c.info,c.standard,c.krate,c.phc,c.plc,c.pc,c.frate,c.fphc,c.fplc,c.fpc from c where c.examId =  '{id}' and c.progress = true ";
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamClassResult>(queryText: queryClass, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamClassResult-{info.school}") }))
+                    {
+                        examClassResults.Add(item);
+
+                    }
+                }
+                else {
+                    var queryClass = $"select c.id,c.name,c.subjectId,c.studentScores,c.studentIds,c.gradeId,c.info,c.standard,c.krate,c.phc,c.plc,c.pc,c.frate,c.fphc,c.fplc,c.fpc from c where c.examId =  '{id}' and c.progress = true ";
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamClassResult>(queryText: queryClass, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamClassResult-{code}") }))
+                    {
+                        examClassResults.Add(item);
 
+                    }
                 }
+               
                 touch = info.touch;
                 income = info.income;
                 /*foreach (Period period in school.period)
@@ -552,7 +564,10 @@ namespace TEAMModelOS.Controllers.Analysis
                             }
                             grades.Add(gradeAys);
                             //处理学生年级相关的pr值
-                            var studentAys = students.Where(x => x.gradeId.Equals(gid)).ToList();
+                            var studentAys = students;
+                            if (!gid.Equals("-")) {
+                                studentAys = students.Where(x => x.gradeId.Equals(gid)).ToList();
+                            }                           
                             var stuGradeTotal = studentAys.Select(x => x.total).ToList();
                             stuGradeTotal.Sort((s1, s2) => { return s2.CompareTo(s1); });
                             var stuCount = stuGradeTotal.Count;

+ 2 - 2
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -565,7 +565,7 @@ namespace TEAMModelOS.Controllers
                     await table.Save<SchoolYear>(sy);
                 }
                 var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime,c.source, c.subjects, c.grades,c.owner, c.scope,c.classes,c.sRate,c.lostStu,c.sStatus,c.qamode,c.school from c " +
-                    $"where (c.status<>404 or IS_DEFINED(c.status) = false and c.scope = 'school' and c.school = '{code}') and c.pk = 'Exam'";
+                    $"where (c.status<>404 or IS_DEFINED(c.status) = false) and c.scope = 'school' and c.school = '{code}' and c.pk = 'Exam'";
                 if (requert.TryGetProperty("classIds", out JsonElement classIds))
                 {
                     List<string> ids = classIds.ToObject<List<string>>();
@@ -584,7 +584,7 @@ namespace TEAMModelOS.Controllers
                     }
                     string ss = string.Join(" or ", strs);
                     query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.source,c.subjects, c.grades,c.owner, c.scope,c.classes,c.sRate,c.lostStu,c.sStatus,c.qamode,c.school from c " +
-                        $"where ({ss}) and (c.status<>404 or IS_DEFINED(c.status) = false and c.scope = 'school' and c.school = '{code}') and c.pk = 'Exam'";
+                        $"where ({ss}) and (c.status<>404 or IS_DEFINED(c.status) = false) and c.scope = 'school' and c.school = '{code}' and c.pk = 'Exam'";
                 };
 
                 string continuationToken = string.Empty;

+ 1 - 0
TEAMModelOS/appsettings.Development.json

@@ -26,6 +26,7 @@
     "Cosmos": {
       //"ConnectionString": "AccountEndpoint=https://teammodel.documents.azure.com:443/;AccountKey=opemBAZi0yATewIlhxDYoIEUqncT5qJh3pUBZsBkTqEkuLYTuu3VS7oaDGJlPp8ASwm5SVSrK2caJsjgmqRw9g==;"
       "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
+      //"ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
     },
     "Redis": {
       "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"