Browse Source

阅卷设置信息调整,评分规则调整

zhouj1203@hotmail.com 3 years ago
parent
commit
eee65574ed

+ 25 - 6
TEAMModelFunction/TriggerCorrect.cs

@@ -145,16 +145,12 @@ namespace TEAMModelFunction
                                 List<Task<ItemResponse<Scoring>>> tasks = new List<Task<ItemResponse<Scoring>>>();
                                 //初始化老师阅卷记录
                                 //List<string> tmds = new List<string>();
-                                List<Info> infos = new List<Info>();
                                 List<string> marks = new List<string>();
                                 for (int i = 0; i < correct.num; i++) {
-                                    //tmds.Add("");
-                                    Info fo = new Info();
-                                    infos.Add(fo);
                                     marks.Add("");
                                 }
                                 //初始化阅卷试题部分数据
-                                List<Item> items = new List<Item>();
+                                /*List<Item> items = new List<Item>();
                                 foreach (double psc in paperPoint) {
                                     Item item = new Item
                                     {
@@ -162,13 +158,36 @@ namespace TEAMModelFunction
                                        scores = infos
                                     };
                                     items.Add(item);
-                                }
+                                }*/
                                 foreach (ExamClassResult examClass in classResults)
                                 {
                                     foreach (string stuId in examClass.studentIds)
                                     {
                                         int index = examClass.studentIds.IndexOf(stuId);
                                         if (index > -1) {
+                                            List<double> scc = examClass.studentScores[index];
+                                            List<Item> items = new List<Item>();
+                                            int itemIndex = 0;
+                                            foreach (double psc in scc)
+                                            {
+                                                List<Info> infos = new List<Info>();
+/*                                                for (int i = 0; i < correct.num; i++)
+                                                {
+                                                    Info fo = new Info
+                                                    {
+                                                        sc = psc,
+                                                        index = itemIndex
+                                                    };
+                                                    infos.Add(fo);
+                                                }*/
+                                                Item item = new Item
+                                                {
+                                                    ssc = paperPoint[itemIndex],
+                                                    scores = infos
+                                                };
+                                                itemIndex++;
+                                                items.Add(item);
+                                            }
                                             Scoring sc = new Scoring
                                             {
                                                 id = Guid.NewGuid().ToString(),

+ 2 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/Correct.cs

@@ -77,6 +77,8 @@ namespace TEAMModelOS.SDK.Models.Cosmos
         /// </summary>
         public int isArb { get; set; }
         public string source { get; set; }
+
+        public int modle { get; set; }
     }
 
     public class CorSub{

+ 3 - 0
TEAMModelOS.SDK/Models/Cosmos/Teacher/CorrectTask.cs

@@ -38,5 +38,8 @@ namespace TEAMModelOS.SDK.Models
         /// 阅卷数量
         /// </summary>
         public int count { get; set; }
+        public List<int> qu { get; set; } = new List<int>();
+        //阅卷类型
+        public string type { get; set; }
     }
 }

+ 37 - 33
TEAMModelOS/Controllers/Analysis/AchievementController.cs

@@ -3904,44 +3904,48 @@ namespace TEAMModelOS.Controllers.Analysis
                                                         char[] str = aa.ToCharArray();
                                                         foreach (char a in aa)
                                                         {
-                                                            switch (a)
-                                                            {
-                                                                case '1':
-                                                                    ans.Add("A");
-                                                                    oans.Add("A");
-                                                                    break;
-                                                                case '2':
-                                                                    ans.Add("B");
-                                                                    oans.Add("B");
-                                                                    break;
-                                                                case '3':
-                                                                    ans.Add("C");
-                                                                    oans.Add("C");
-                                                                    break;
-                                                                case '4':
-                                                                    ans.Add("D");
-                                                                    oans.Add("D");
-                                                                    break;
-                                                                case '5':
-                                                                    ans.Add("E");
-                                                                    oans.Add("E");
-                                                                    break;
-                                                                case '6':
-                                                                    ans.Add("F");
-                                                                    oans.Add("F");
-                                                                    break;
-                                                                default:
-                                                                    ans.Add("");
-                                                                    oans.Add("");
-                                                                    break;
-                                                            }
+                                                            ans.Add(a.ToString());
+                                                            oans.Add(a.ToString());
+                                                            /* switch (a)
+                                                             {
+                                                                 case '1':
+                                                                     ans.Add("A");
+                                                                     oans.Add("A");
+                                                                     break;
+                                                                 case '2':
+                                                                     ans.Add("B");
+                                                                     oans.Add("B");
+                                                                     break;
+                                                                 case '3':
+                                                                     ans.Add("C");
+                                                                     oans.Add("C");
+                                                                     break;
+                                                                 case '4':
+                                                                     ans.Add("D");
+                                                                     oans.Add("D");
+                                                                     break;
+                                                                 case '5':
+                                                                     ans.Add("E");
+                                                                     oans.Add("E");
+                                                                     break;
+                                                                 case '6':
+                                                                     ans.Add("F");
+                                                                     oans.Add("F");
+                                                                     break;
+                                                                 default:
+                                                                     ans.Add("");
+                                                                     oans.Add("");
+                                                                     break;
+                                                             }*/
                                                         }
                                                         objective.Add(oans);
                                                         answers.Add(ans);
                                                     }
                                                     else
                                                     {
-                                                        switch (aa)
+                                                        ans.Add(aa);
+                                                        oans.Add(aa);
+                                                        /*switch (aa)
                                                         {
                                                             case "1":
                                                                 ans.Add("A");
@@ -3971,7 +3975,7 @@ namespace TEAMModelOS.Controllers.Analysis
                                                                 ans.Add("");
                                                                 oans.Add("");
                                                                 break;
-                                                        }
+                                                        }*/
                                                         objective.Add(oans);
                                                         answers.Add(ans);
                                                     }

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

@@ -1829,7 +1829,7 @@ namespace TEAMModelOS.Controllers
                 value.RootElement.TryGetProperty("info", out JsonElement element);
                 List<tmdInfo> tmds = element.ToObject<List<tmdInfo>>();*/
                 List<double> ssc = score.ToObject<List<double>>();
-                StringBuilder builder = new StringBuilder();
+                StringBuilder builder = new();
                 if (requert.TryGetProperty("mark", out JsonElement mark))
                 {
                     //存放老师批注信息到blob                   
@@ -1856,15 +1856,30 @@ namespace TEAMModelOS.Controllers
                     foreach (SDK.Models.Cosmos.Common.Scoring scoring in attr)
                     {
                         int itemIndex = 0;
-                        int tIdIndex = scoring.tIds.IndexOf(tId.GetString());
+                        //int tIdIndex = scoring.tIds.IndexOf(tId.GetString());
                         foreach (Item item in scoring.items)
                         {
-                            if (tIdIndex > -1)
+                            List<Info> items =  item.scores.Where(x => x.tmdId.Equals(tId.GetString())).ToList();
+                            if (items.Count > 0)
+                            {
+                                foreach (Info info in items)
+                                {
+                                    info.sc = ssc[itemIndex];
+                                }
+                            }
+                            else {
+                                Info info = new();
+                                info.sc = ssc[itemIndex];
+                                info.tmdId = tId.GetString();
+                                info.index = itemIndex;
+                            }
+                            itemIndex++;
+                            /*if (tIdIndex > -1)
                             {
                                 item.scores[tIdIndex].sc = ssc[itemIndex];
                                 item.scores[tIdIndex].tmdId = tId.GetString();
                                 itemIndex++;
-                            }
+                            }*/
 
                         }
                         await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey(scoring.code));
@@ -1874,6 +1889,7 @@ namespace TEAMModelOS.Controllers
                 //判定阅卷结算的条件
                 if (attr.Count == count.GetInt32())
                 {
+
                     await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<ExamClassResult>(
                     queryText: $"select value(c) from c where c.examId = '{id}' and c.subjectId = '{subjectId}'",
                     requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamClassResult-{code}") }))
@@ -1889,10 +1905,14 @@ namespace TEAMModelOS.Controllers
                             int n = 0;
                             foreach (Item item in scoring.items)
                             {
+                                var ace =  item.scores.Where(x => string.IsNullOrEmpty(x.tmdId)).ToList();
+                                if (ace.Count > 0) {
+                                    return Ok(new { code = 200 });
+                                }
                                 //判定是否仲裁卷
                                 if (!item.flag)
                                 {
-                                    break;
+                                    return Ok(new { msg = "试题分数差异过大" });
                                 }
                                 double sc = item.scores.Select(x => x.sc).ToList().Aggregate((i, j) => (i + j) / item.scores.Count);
                                 scoring.scores[n] = sc;