Przeglądaj źródła

选项计数以及题目分数

zhouj1203@hotmail.com 4 lat temu
rodzic
commit
ddc3e05b2f

+ 9 - 9
TEAMModelFunction/TriggerExam.cs

@@ -341,25 +341,25 @@ namespace TEAMModelFunction
                         examResults.Add(item);
                     }
                     //结算单科单班的标准差和平均分
-                    foreach (ExamResult exam in examResults) {
+                    foreach (ExamClassResult classResult in examClassResults) {
                         //标记单科单班总得分
                         double subScore = 0;
                         //标准差
                         double sPowSum = 0;
-                        var scount = exam.studentIds.Count;
-                        foreach (List<double> sc in exam.studentScores)
+                        var scount = classResult.studentIds.Count;
+                        foreach (List<double> sc in classResult.studentScores)
                         {
                             subScore += sc.Sum();
                         }
-                        foreach (string sid in exam.studentIds)
+                        foreach (string sid in classResult.studentIds)
                         {
-                            double ssc = exam.studentScores[exam.studentIds.IndexOf(sid)].Sum();
+                            double ssc = classResult.studentScores[classResult.studentIds.IndexOf(sid)].Sum();
                             sPowSum += Math.Pow(ssc - scount > 0 ? Math.Round(subScore * 1.0 / scount, 2) : 0, 2);
 
                         }
-                        exam.standard = Math.Round(scount > 0 ? Math.Pow(sPowSum / scount, 0.5) : 0, 2);
-                        exam.average = scount > 0 ? Math.Round(subScore / scount, 2) : 0;
-                        await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, exam.id, new Azure.Cosmos.PartitionKey($"{exam.code}"));
+                        classResult.standard = Math.Round(scount > 0 ? Math.Pow(sPowSum / scount, 0.5) : 0, 2);
+                        classResult.average = scount > 0 ? Math.Round(subScore / scount, 2) : 0;
+                        await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(classResult, classResult.id, new Azure.Cosmos.PartitionKey($"{classResult.code}"));
                     }
                     //记录某次考试所有学生得分总分
                     double score = 0;
@@ -462,7 +462,7 @@ namespace TEAMModelFunction
                     }
                     recorde.Add(optCount);
                 }
-                info.papers[no].recorde = recorde;
+                info.papers[no].record = recorde;
             }
             catch (Exception ex)
             {

+ 1 - 1
TEAMModelOS.SDK/Models/Cosmos/School/ExamInfo.cs

@@ -116,7 +116,7 @@ namespace TEAMModelOS.SDK.Models
         //题目类型
         public List<string> type { get; set; } = new List<string>();
         public List<int> field { get; set; } = new List<int>();
-        public List<Dictionary<string, int>> recorde = new List<Dictionary<string, int>>();
+        public List<Dictionary<string, int>> record { get; set; } = new List<Dictionary<string, int>>();
     }
     /*public class Condition
     {

+ 16 - 3
TEAMModelOS/Controllers/Analysis/AchievementController.cs

@@ -2880,10 +2880,10 @@ namespace TEAMModelOS.Controllers.Analysis
                                     });
                                     ex.studentScores = newScores;
                                     int index = 0;
-                                    List<Task<string>> tasks = new List<Task<string>>();
-                                    List<List<string>> answers = new List<List<string>>();
+                                    List<Task<string>> tasks = new List<Task<string>>();                                    
                                     foreach (List<string> an in examClass.studentAnswers)
                                     {
+                                        List<List<string>> answers = new List<List<string>>();
                                         //List<List<string>> stuAns = new List<List<string>>();
                                         an.ForEach(aa =>
                                         {
@@ -2907,12 +2907,18 @@ namespace TEAMModelOS.Controllers.Analysis
                                                         case '4':
                                                             ans.Add("D");
                                                             break;
+                                                        case '5':
+                                                            ans.Add("E");
+                                                            break;
+                                                        case '6':
+                                                            ans.Add("F");
+                                                            break;
                                                         default:
                                                             ans.Add("");
                                                             break;
                                                     }
-                                                    answers.Add(ans);
                                                 }
+                                                answers.Add(ans);
                                             }
                                             else
                                             {
@@ -2930,6 +2936,12 @@ namespace TEAMModelOS.Controllers.Analysis
                                                     case "4":
                                                         ans.Add("D");
                                                         break;
+                                                    case "5":
+                                                        ans.Add("E");
+                                                        break;
+                                                    case "6":
+                                                        ans.Add("F");
+                                                        break;
                                                     default:
                                                         ans.Add("");
                                                         break;
@@ -2941,6 +2953,7 @@ namespace TEAMModelOS.Controllers.Analysis
                                         string FileName = ex.examId + "/" + ex.subjectId + "/" + examClass.studentIds[index];
                                         string blob =  FileName + "/" + "ans.json";
                                         tasks.Add(_azureStorage.UploadFileByContainer(ex.school.ToString(), answers.ToJsonString(), "exam", FileName + "/" + "ans.json"));
+                                        ex.studentAnswers[index].Clear();
                                         ex.studentAnswers[index].Add(blob);
                                         index++;
                                     }

+ 9 - 1
TEAMModelOS/Controllers/Analysis/AnalysisController.cs

@@ -276,6 +276,7 @@ namespace TEAMModelOS.Controllers.Analysis
                             StudentSubject subject = new StudentSubject
                             {
                                 id = examResult.subjectId,
+                                scores = examResult.studentScores[examResult.studentIds.IndexOf(stuid)],
                                 name = info.subjects.Where(x => x.id == examResult.subjectId).FirstOrDefault().name,
                                 point = stuPerDatas.Where(x => x.Key == examResult.subjectId).SelectMany(va=>va.Value).Where(stu=>stu.Key==stuid).Select(pi => pi.Value).First(),
                                 fieldPoint = fieldStuPerDatas.Where(x => x.Key == examResult.subjectId).SelectMany(va => va.Value).Where(stu => stu.Key == stuid).Select(pi => pi.Value).First()
@@ -688,7 +689,14 @@ namespace TEAMModelOS.Controllers.Analysis
                         values.Add("-");
                     });
                     values[0] = (k + 1).ToString();
-                    values[1] =  "";
+                    if (e.paper.type.Count > 0)
+                    {
+                        values[1] = e.paper.type[k].ToString();
+                    }
+                    else {
+                        values[1] = "";
+                    }
+                    
                     values[2] = topic[k].ToString();
                     values[3] = e.paper.point[k].ToString();
 /*                    List<string> sk = new List<string>();

+ 1 - 0
TEAMModelOS/Controllers/Analysis/StudentAys.cs

@@ -35,5 +35,6 @@ namespace TEAMModelOS.Controllers.Analysis
         public int csort { get; set; }
         public int gsort { get; set; }
         public double sRate { get; set; }
+        public List<double> scores { get; set; }
     }
 }