浏览代码

Merge branch 'develop' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop

jeff 9 月之前
父节点
当前提交
6b8a094480

+ 2 - 2
TEAMModelOS/ClientApp/src/view/classrecord/ClassRecord.vue

@@ -298,7 +298,7 @@ export default {
         {
           value: 'Interactive',
           text: this.$t('cusMgt.rcd.filter4'),
-          events: ['PopQuesLoad', 'ReAtmpAnsStrt', 'BuzrLoad'],
+          events: ['PopQuesLoad', 'ReAtmpAnsStrt', 'BuzrLoad', 'BuzrAns'],
           count: 0
         },
         {
@@ -549,7 +549,7 @@ export default {
             item.pageUrl = `${this.blobInfo.blob_uri}/records/${this.recordInfo.id}${item.pageMeta}/bg_snapshot_00001.jpg${this.blobInfo.blob_sas}`
           }
         })
-      } catch (e) {
+      } catch (e) { 
         this.pushData = []
       }
       try {

+ 26 - 9
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -376,9 +376,9 @@ namespace TEAMModelOS.Controllers
         }
 
         [ProducesDefaultResponseType]
-        [AuthToken(Roles = "teacher,admin")]
+        //[AuthToken(Roles = "teacher,admin")]
         [HttpPost("get-exam-point")]
-        [Authorize(Roles = "IES")]
+        //[Authorize(Roles = "IES")]
         public async Task<IActionResult> getExamPoint(JsonElement request)
         {
             try
@@ -391,7 +391,9 @@ namespace TEAMModelOS.Controllers
                 var client = _azureCosmos.GetCosmosClient();
                 List<string> ids = new List<string>();
                 List<string> clds = classId.ToObject<List<string>>().ToList();
-                var queryExam = $"select c.id from c where c.period.id = '{periodId}' and array_contains(c.classes,'{clds[0]}') " +
+                List<ExamSubject> subs = new();
+                List<(string id,string type)> source = new();
+                var queryExam = $"select c.id,c.subjects,c.source from c where c.period.id = '{periodId}' and array_contains(c.classes,'{clds[0]}') " +
                     $"and c.qamode <> 2 and c.progress = 'finish' and c.scope = 'school' and c.startTime > {startTime} and c.startTime < {endTime} ";
                 await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryStreamIteratorSql(queryText: queryExam, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{code}") }))
                 {
@@ -403,9 +405,15 @@ namespace TEAMModelOS.Controllers
                         {
                             JsonElement account = accounts.Current;
                             ids.Add(account.GetProperty("id").GetString());
+                            if (account.TryGetProperty("subjects", out JsonElement subject))
+                            {
+                                subs.AddRange(subject.ToObject<List<ExamSubject>>());
+                            }
+                            source.Add((account.GetProperty("id").GetString(), account.GetProperty("source").GetString()));
                         }
                     }
                 }
+                subs = subs.Where((x, i) => subs.FindIndex(z => z.id == x.id) == i).ToList();
                 var queryClass = $"select value(c) from c where c.info.id = '{clds[0]}'and c.examId in ({string.Join(",", ids.Select(o => $"'{o}'"))})";
                 List<ExamClassResult> classResults = new();
                 await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIteratorSql<ExamClassResult>(queryText: queryClass, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamClassResult-{code}") }))
@@ -413,8 +421,14 @@ namespace TEAMModelOS.Controllers
                     classResults.Add(item);
                 }
 
+                var typeCount =  source.GroupBy(x => x.type).Select(z => new { 
+                    z.Key,
+                    count = z.ToList().Count
+                });
+
+                (List<RMember> members, List<RGroupList> groups) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, clds, $"{code}");
                 //计算几次合并
-               
+
                 var examScore = classResults.GroupBy(c => c.subjectId).Select(x => new
                 {
                     x.Key,
@@ -437,21 +451,24 @@ namespace TEAMModelOS.Controllers
                 {
                     var orderScore = stuScore.Select(x => new
                     {
-                        x.sub,
-                        classRate = x.subScore.Select(z => z.score).Sum() / x.subScore.Count,
+                        subjectId = x.sub,
+                        subjectName = subs.Where(z => z.id.Equals(x.sub)).FirstOrDefault().name,
+                        classRate = x.subScore.Select(z => z.score).Sum()/ x.cc / x.subScore.Count,
                         rank = x.subScore.OrderByDescending(x => x.score).Select(z => z.id).ToList().IndexOf(studentId.GetString()) + 1,
                         stuRate = x.subScore.OrderByDescending(x => x.score).Select(z => new
                         {
                             z.id,
+                            name = members.Where(s => s.id.Equals(z.id)).FirstOrDefault().name,
                             per = z.score / x.cc
                         }).ToList().Take(10)
                     }) ;
-                    return Ok(new { orderScore, code = 200 });
+                    return Ok(new { orderScore, typeCount, pCount = members.Count, code = 200 });
                 }
                 else {
                     var orderScore = stuScore.Select(x => new
                     {
-                        x.sub,
+                        subjectId = x.sub,
+                        subjectName = subs.Where(z => z.id.Equals(x.sub)).FirstOrDefault().name,
                         classRate = x.subScore.Select(z => z.score).Sum() / x.subScore.Count,
                         stuRate = x.subScore.OrderByDescending(x => x.score).Select(z => new
                         {
@@ -459,7 +476,7 @@ namespace TEAMModelOS.Controllers
                             per = z.score / x.cc
                         }).ToList().Take(10)
                     });
-                    return Ok(new { orderScore, code = 200 });
+                    return Ok(new { orderScore, typeCount, pCount = members.Count, code = 200 });
                 }