瀏覽代碼

平均分结算

zhouj1203@hotmail.com 4 年之前
父節點
當前提交
e6374dae4e

+ 1 - 0
TEAMModelFunction/TriggerExam.cs

@@ -362,6 +362,7 @@ namespace TEAMModelFunction
                     {
                         allScore += simple.point.Sum();
                     }
+                    
                     info.sRate = allScore > 0 ? Math.Round(ascore / allScore * 100,2) : 0;
                     info.lostStu = losStu;
                     await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync<ExamInfo>(info, info.id, new Azure.Cosmos.PartitionKey(info.code));

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

@@ -83,6 +83,7 @@ namespace TEAMModelOS.SDK.Models
         /// TTL删除改变状态使用
         /// </summary>
         public int? status { get; set; } = 0;
+        public double average { get; set; }
         //得分率
         public double sRate { get; set; }
         //缺考人数

+ 10 - 4
TEAMModelOS/Controllers/Analysis/AnalysisController.cs

@@ -365,8 +365,8 @@ namespace TEAMModelOS.Controllers.Analysis
                             x.name =x.id;
                             x.no = "-";
                         }
-                        //班级得分率
-                        x.csRate = totalAll > 0 ? Math.Round(totalAverage / totalAll,2) : 0;
+                      /*  //班级得分率
+                        x.csRate = totalAll > 0 ? Math.Round(totalAverage / totalAll,2) : 0;*/
                         //标准差
                         powSum += Math.Pow(x.total - totalAverage, 2);
                         //进线人数
@@ -412,6 +412,7 @@ namespace TEAMModelOS.Controllers.Analysis
                         studentIds = studentIds,
                         stuCount = stuCount,
                         classId = classId,
+                        csRate = totalAll > 0 ? Math.Round(totalAverage / totalAll, 2) : 0,
                         className = classroom.name,
                         totalAverage = totalAverage,
                         lineCount = lineCount,
@@ -528,11 +529,16 @@ namespace TEAMModelOS.Controllers.Analysis
                         });
                     });
                 });
+                var sub = info.subjects.Select(x => new {
+                    id = x.id,
+                    name = x.name,
+                    sRate = examResults.FirstOrDefault(c => c.id == x.id).sRate
+                });
             }
+
             catch (Exception ex) {
                 BadRequest(ex.StackTrace);
-            }
-            var sub = info.subjects.Select(x => new { id = x.id, name = x.name });
+            }          
             return Ok(new { students,
                 classes,
                 grades,

+ 2 - 0
TEAMModelOS/Controllers/Analysis/ClassAys.cs

@@ -21,6 +21,8 @@ namespace TEAMModelOS.Controllers.Analysis
         public double totalAverage { get; set; }
         public double standardDeviation { get; set; }
         public string gradeId { get; set; }
+        //¼Ç¼°à¼¶µÃ·ÖÂÊ
+        public double csRate { get; set; }
     }
     public class AysSubject
     {