Explorar el Código

阅卷打分逻辑调整

zhouj1203@hotmail.com hace 3 años
padre
commit
5841ba52f6

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

@@ -20,6 +20,8 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Common
         public List<string> marks { get; set; } = new List<string>();
         public List<string> marks { get; set; } = new List<string>();
         public List<double> scores { get; set; } = new List<double>();
         public List<double> scores { get; set; } = new List<double>();
         public int modle { get; set; }
         public int modle { get; set; }
+        public string mode { get; set; }
+
     }
     }
 
 
     public class Item
     public class Item

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

@@ -1691,7 +1691,7 @@ namespace TEAMModelOS.Controllers
                         Random random = new Random();
                         Random random = new Random();
                         SDK.Models.Cosmos.Common.Scoring item = new();
                         SDK.Models.Cosmos.Common.Scoring item = new();
                         List<SDK.Models.Cosmos.Common.Scoring> notYet = new();
                         List<SDK.Models.Cosmos.Common.Scoring> notYet = new();
-                        notYet =  all.Where(x => x.tIds.Count < x.marks.Count * x.modle - 1).ToList();
+                        notYet = all.Where(x => x.tIds.Count < x.marks.Count * x.modle - 1).ToList();
                         if (notYet.Count > 0)
                         if (notYet.Count > 0)
                         {
                         {
                             item = notYet[random.Next(notYet.Count)];
                             item = notYet[random.Next(notYet.Count)];
@@ -1842,32 +1842,37 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         foreach (SDK.Models.Cosmos.Common.Scoring scoring in attr)
                         foreach (SDK.Models.Cosmos.Common.Scoring scoring in attr)
                         {
                         {
-                            foreach (Item item in scoring.items) {
+                            foreach (Item item in scoring.items)
+                            {
                                 bool flag = false;
                                 bool flag = false;
                                 int index = 0;
                                 int index = 0;
-                                if (item.scores.Count > 0) {
-                                    foreach (Info info in item.scores) {
+                                if (item.scores.Count > 0)
+                                {
+                                    foreach (Info info in item.scores)
+                                    {
                                         if (!info.tmdId.Equals(tId.GetString()))
                                         if (!info.tmdId.Equals(tId.GetString()))
                                         {
                                         {
                                             index++;
                                             index++;
                                         }
                                         }
-                                        else {
+                                        else
+                                        {
                                             scoring.marks[index] = builder.ToString();
                                             scoring.marks[index] = builder.ToString();
                                             flag = true;
                                             flag = true;
                                             break;
                                             break;
                                         }
                                         }
                                     }
                                     }
                                 }
                                 }
-                                if (flag) {
+                                if (flag)
+                                {
                                     break;
                                     break;
                                 }
                                 }
-                                 //List<Info> info = item.scores.Where(x => x.tmdId.Equals(tId.GetString())).ToList();
+                                //List<Info> info = item.scores.Where(x => x.tmdId.Equals(tId.GetString())).ToList();
                             }
                             }
-                           /* int index = scoring.tIds.IndexOf(tId.GetString());
-                            if (index != -1)
-                            {
-                                scoring.marks[index] = builder.ToString();
-                            }*/
+                            /* int index = scoring.tIds.IndexOf(tId.GetString());
+                             if (index != -1)
+                             {
+                                 scoring.marks[index] = builder.ToString();
+                             }*/
 
 
                         }
                         }
                     }
                     }
@@ -1878,24 +1883,53 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         int itemIndex = 0;
                         int itemIndex = 0;
                         //int tIdIndex = scoring.tIds.IndexOf(tId.GetString());
                         //int tIdIndex = scoring.tIds.IndexOf(tId.GetString());
-                        foreach (Item item in scoring.items)
+                        if (requert.TryGetProperty("qu", out JsonElement qu))
                         {
                         {
-                            List<Info> items =  item.scores.Where(x => x.tmdId.Equals(tId.GetString())).ToList();
-                            if (items.Count > 0)
+                            List<int> nos = qu.ToObject<List<int>>();
+                            foreach (int number in nos)
                             {
                             {
-                                foreach (Info info in items)
+                                List<Info> items = scoring.items[number - 1].scores.Where(x => x.tmdId.Equals(tId.GetString())).ToList();
+                                
+                                if (items.Count > 0)
                                 {
                                 {
-                                    info.sc = ssc[itemIndex];
+                                    foreach (Info info in items)
+                                    {
+                                        info.sc = ssc[number - 1];
+                                    }
                                 }
                                 }
+                                else {
+                                    Info info = new();
+                                    info.sc = ssc[number - 1];
+                                    info.tmdId = tId.GetString();
+                                    info.index = number - 1;
+                                    scoring.items[number - 1].scores.Add(info);
+                                }                                                              
                             }
                             }
-                            else {
-                                Info info = new();
-                                info.sc = ssc[itemIndex];
-                                info.tmdId = tId.GetString();
-                                info.index = itemIndex;
+                        }
+                        else
+                        {
+                            foreach (Item item in scoring.items)
+                            {
+                                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;
+                                    item.scores.Add(info);
+                                }
+                                itemIndex++;
                             }
                             }
-                            itemIndex++;
                         }
                         }
+
                         await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey(scoring.code));
                         await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey(scoring.code));
 
 
                     }
                     }
@@ -1919,8 +1953,9 @@ namespace TEAMModelOS.Controllers
                             int n = 0;
                             int n = 0;
                             foreach (Item item in scoring.items)
                             foreach (Item item in scoring.items)
                             {
                             {
-                                var ace =  item.scores.Where(x => string.IsNullOrEmpty(x.tmdId)).ToList();
-                                if (ace.Count > 0) {
+                                var ace = item.scores.Where(x => string.IsNullOrEmpty(x.tmdId)).ToList();
+                                if (ace.Count > 0)
+                                {
                                     return Ok(new { code = 200 });
                                     return Ok(new { code = 200 });
                                 }
                                 }
                                 //判定是否仲裁卷
                                 //判定是否仲裁卷