Bladeren bron

处理知识点,认知层次全班结算

zhouj1203@hotmail.com 3 jaren geleden
bovenliggende
commit
353287f49d
2 gewijzigde bestanden met toevoegingen van 27 en 7 verwijderingen
  1. 10 2
      TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs
  2. 17 5
      TEAMModelOS/Controllers/Common/ExamController.cs

+ 10 - 2
TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs

@@ -945,7 +945,11 @@ namespace TEAMModelOS.FunctionV4
 
                                         if (result.studentScores.Count > 0)
                                         {
-                                            score += result.studentScores.Sum(r => r.Sum()) * itemPersent;
+                                            foreach (List<double> sc in result.studentScores)
+                                            {
+                                                double tsc = sc[n] == -1 ? 0 : sc[n];
+                                                score += tsc * itemPersent;
+                                            }
                                         }
                                     }
                                     n++;
@@ -1078,7 +1082,11 @@ namespace TEAMModelOS.FunctionV4
 
                                     if (result.studentScores.Count > 0)
                                     {
-                                        score += result.studentScores.Sum(r => r.Sum()) * itemPersent;
+                                        foreach (List<double> sc in result.studentScores)
+                                        {
+                                            double tsc = sc[n] == -1 ? 0 : sc[n];
+                                            score += tsc * itemPersent;
+                                        }
                                     }
                                 }
                                 n++;

+ 17 - 5
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -1575,8 +1575,8 @@ namespace TEAMModelOS.Controllers
                 }
                 if (papers.IsNotEmpty())
                 {
-                    var knowledge = know.Select(k => new { k.kn, k.kps, k.ckps,k.akps });
-                    var filed = fp.Select(k => new { k.fs, k.fps, k.cfps,k.afps });
+                    var knowledge = know.Select(k => new { k.kn, k.kps, k.ckps, k.akps });
+                    var filed = fp.Select(k => new { k.fs, k.fps, k.cfps, k.afps });
                     //papers = papers
                     return Ok(new { papers, subjects, stuScore, stuAns, mark, total, claId = infoIds, knowledge, filed, average, status = 200 });
                 }
@@ -1595,7 +1595,7 @@ namespace TEAMModelOS.Controllers
         }
         private IEnumerable<(List<(List<string> kn, List<double> kps, List<double> ckps, List<double> akps)> know, List<(List<int> fs, List<double> fps, List<double> cfps, List<double> afps)> filed)> stuTask(List<string> subjectIds, List<PaperSimple> papers, List<ExamClassResult> answers, string stuId)
         {
-            List<(List<string> kn, List<double> kps, List<double> ckps, List<double> akps)> know = new List<(List<string> kn, List<double> kps, List<double> ckps,List<double> akp)> ();
+            List<(List<string> kn, List<double> kps, List<double> ckps, List<double> akps)> know = new List<(List<string> kn, List<double> kps, List<double> ckps, List<double> akp)>();
             List<(List<int> fs, List<double> fps, List<double> cfps, List<double> afps)> filed = new List<(List<int> fs, List<double> fps, List<double> cfps, List<double> afps)>();
             int no = 0;
             foreach (string sub in subjectIds)
@@ -1715,7 +1715,13 @@ namespace TEAMModelOS.Controllers
 
                                     if (result.studentScores.Count > 0)
                                     {
-                                        score += result.studentScores.Sum(r => r.Sum()) * itemPersent;
+                                        /*score += result.studentScores.ForEach(r => r[n]) * itemPersent;*/
+                                        foreach (List<double> sc in result.studentScores)
+                                        {
+                                            double tsc = sc[n] == -1 ? 0 : sc[n];
+                                            score += tsc * itemPersent;
+                                        }
+
                                     }
                                 }
                                 n++;
@@ -1749,9 +1755,15 @@ namespace TEAMModelOS.Controllers
 
                                     if (result.studentScores.Count > 0)
                                     {
-                                        score += result.studentScores.Sum(r => r.Sum()) * itemPersent;
+                                        foreach (List<double> sc in result.studentScores)
+                                        {
+                                            double tsc = sc[n] == -1 ? 0 : sc[n];
+                                            score += tsc * itemPersent;
+
+                                        }
                                     }
                                 }
+                                n++;
                             }
                             count += result.studentIds.Count;
                         }