CrazyIter_Bin 9 月之前
父節點
當前提交
718bc9a5d1

+ 125 - 8
TEAMModelOS.Extension/HTEX.Test/Controllers/LessonRecordController.cs

@@ -113,6 +113,7 @@ namespace HTEX.Test.Controllers
                         }
                     }
 
+                   
                     //读取互评信息
                     //Event 过滤类型  'RatingStart'
                     //smartRateSummary.mutualSummary.mutualType 互评【All(每人多件评分)  Two(随机分配互评)  Self(自评)】 smartRateSummary.meteor_VoteSummary 投票 
@@ -150,7 +151,7 @@ namespace HTEX.Test.Controllers
                         }
                     }
                     //读取协作信息
-                    ///Event 过滤类型  'CoworkLoad'
+                    ///Event 过滤类型  'CoworkLoad', "CoworkType":"CoworkGroup",类型
                     //Cowork.json 中找到对应类型,根据Pgid 去 Cowork.json 中找到对应数据
                     List<CoworkData> coworkDatas = new List<CoworkData>();
                     try
@@ -166,6 +167,43 @@ namespace HTEX.Test.Controllers
                             _logger.LogError(ex, $"文件不存在:/records/{item.id}/IES/Cowork.json");
                         }
                     }
+
+                    //读取ExamData
+                    List<ExamData> examDatas = new List<ExamData>();
+
+                    try {
+
+                        var examPages =  timeLineData?.events.Where(x => string.IsNullOrWhiteSpace(x.ExamId));
+                        if (examDatas!=null  && examDatas.Count>0) 
+                        {
+                           var examsFiles = await _azureStorage.GetBlobContainerClient(item.school).List($"/records/{item.id}/Exam/");
+                           var paperFiles = await _azureStorage.GetBlobContainerClient(item.school).List($"/records/{item.id}/ExamPaper/");
+                            foreach (var examsFile in examsFiles)
+                            {
+                                if (examsFile.EndsWith("Exam.json")) 
+                                {
+                                    BlobDownloadResult examDataDownload = await _azureStorage.GetBlobContainerClient(item.school).GetBlobClient(examsFile).DownloadContentAsync();
+                                    ExamData examData = examDataDownload.Content.ToObjectFromJson<ExamData>();
+                                    if (examData.exam.papers.IsNotEmpty())
+                                    {
+                                        string paperId=  examData.exam.papers.First().id;
+                                      
+                                        if (_azureStorage.GetBlobContainerClient(item.school).GetBlobClient($"/records/{item.id}/ExamPaper/{paperId}/index.json").Exists())
+                                        {
+                                            BlobDownloadResult paperblobDownload = await _azureStorage.GetBlobContainerClient(item.school).GetBlobClient($"/records/{item.id}/ExamPaper/{paperId}/index.json").DownloadContentAsync();
+                                            LessonPaper paperIndex = paperblobDownload.Content.ToObjectFromJson<LessonPaper>();
+                                        }
+                                    }
+                                    examDatas.Add(examData);
+                                }
+                            }
+                          
+                        }
+                     
+                    } 
+                    catch (Exception ex) 
+                    {
+                    }
                 }
             }
             return Ok("Lesson records");
@@ -561,6 +599,36 @@ namespace HTEX.Test.Controllers
                                 }
                                 else
                                 {
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //
+                                    //优先根据得分与标准分的占比算出得分率,如果没有得分率,如果是直接从互动,不知道是评测的 需要先去评测找作答得分。,则采用Levenshtein距离来评估两个字符串的相似度
                                     //没有匹配上答案,则采用Levenshtein距离来评估两个字符串的相似度
                                     var sc = CalculateSimilarity(answers![0], ans0[0]) * 1.0/100 *(InteractWeight.TT-InteractWeight.T1);
                                     weight = sc;
@@ -715,12 +783,12 @@ namespace HTEX.Test.Controllers
                                         bool objective = objectiveTypes.Contains(examData.exam.papers[0].type[itemIndex]);
                                         var score =  examData.exam.papers[0].point[itemIndex];
                                         string type = examData.exam.papers[0].type[itemIndex]; 
-                                       // var res= GetInteractResultHasAnswer(answers[itemIndex], ans, objective, type);
+                                        var res= GetInteractResultHasAnswer(answers[itemIndex], ans, objective, type);
                                         ItemRecord interactRecord = new ItemRecord()
                                         {
                                             interactType="SPQStrt",//类型
-                                           // resultType=res.reultType,//作答结果类型
-                                            //resultWeight=res.weight,//得分权重
+                                            resultType=res.reultType,//作答结果类型
+                                            resultWeight=res.weight,//得分权重
                                             criterion= score,//标准分
                                             interactScore= studentScore[itemIndex]//得分
                                         };
@@ -753,7 +821,26 @@ namespace HTEX.Test.Controllers
         {
             foreach (var coworkData in coworkDatas) 
             {
-                
+                var keys = coworkData.participateLevelList.Keys;
+                foreach (var key in keys) 
+                {
+                    var student =  studentLessonDatas.Find(x => x.seatID!.Equals(key));
+                    if (student!=null) 
+                    {
+                        var score = coworkData.participateLevelList[key];
+                        var itemRecord = new ItemRecord {  criterion=-1, interactType= coworkData.coworkType,interactScore=score };
+                        if (score>0)
+                        {
+                            itemRecord.resultWeight =  InteractWeight.T1;
+                            itemRecord.resultType = InteractReultType.T1;
+                        }
+                        else {
+                            itemRecord.resultWeight =  InteractWeight.T0;
+                            itemRecord.resultType = InteractReultType.T0;
+                        }
+                        student.coworkRecord.itemRecords.Add(itemRecord);
+                    }
+                }
             }
             return studentLessonDatas;
         }
@@ -769,6 +856,7 @@ namespace HTEX.Test.Controllers
         /// <returns></returns>
         private async Task<dynamic> GetTaskData(LessonRecord lessonRecord, LessonBase lessonBase, TimeLineData timeLineData, List<TaskData> taskDatas, List<StudentLessonData> studentLessonDatas)
         {
+            //协作也算任务的一种,'WrkSpaceLoad' 作品收集, "isGroupItem": false,
             return Ok(lessonRecord);
         }
 
@@ -787,9 +875,38 @@ namespace HTEX.Test.Controllers
         }
     }
 
-    
-
+    public class LessonPaper 
+    {
+        
+        public List<LessonPaperSlide> slides { get; set; }= new List<LessonPaperSlide>();
+    }
+    public class LessonPaperSlide
+    {
+        /// <summary>
+        /// blob 路徑
+        /// </summary>
+        public string? url { get; set; }
+        /// <summary>
+        /// 題型
+        /// </summary>
+        public string? type { get; set; }
+        /// <summary>
+        /// scoring
+        /// </summary>
+        public LessonPaperSlideScoring? scoring { get; set; }
+    }
+    public class LessonPaperSlideScoring
+    {
+        /// <summary>
+        /// knowledge
+        /// </summary>
+        public List<string> knowledge { get; set; } = new List<string>();
+        /// <summary>
+        /// 答案
+        /// </summary>
+        public List<string> ans { get; set; } = new List<string>();
 
+    }
     /// <summary>
     /// 学生课中数据
     /// </summary>
@@ -876,7 +993,7 @@ namespace HTEX.Test.Controllers
         /// <summary>
         /// 协作参与记录
         /// </summary>
-        public List<ItemRecord> itemRecords /*{ get; set; }*/ = new List<ItemRecord>();
+        public List<ItemRecord> itemRecords { get; set; } = new List<ItemRecord>();
     }
     /// <summary>
     /// 学生课中评测记录

+ 4 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/ExamClassResult.cs

@@ -64,6 +64,10 @@ namespace TEAMModelOS.SDK.Models
     {
         public List<List<string>>  studentAnswersArray { get; set; }= new List<List<string>>();
     }
+    public class ExamLessonStudentAnswerArray : ExamClassResult
+    {
+        public List<List<List<string>>> studentAnswersArray { get; set; } = new List<List<List<string>>>();
+    }
     /*    public class PaperSimple {
             public string id { get; set; }
             public string name { get; set; }

+ 6 - 3
TEAMModelOS.SDK/Models/Cosmos/Common/LessonRecord.cs

@@ -579,7 +579,7 @@ namespace TEAMModelOS.SDK.Models
     public class ExamData 
     {
         public ExamInfo exam { get; set; }
-        public List<ExamClassResultStudentAnswerArray> examClassResult { get; set; } = new List<ExamClassResultStudentAnswerArray>();
+        public List<ExamLessonStudentAnswerArray> examClassResult { get; set; } = new List<ExamLessonStudentAnswerArray>();
     }
     /// <summary>
     /// IRS.json
@@ -601,7 +601,6 @@ namespace TEAMModelOS.SDK.Models
         public List<string> buzzParticipants { get; set; } = new List<string>();
         public JsonNode question { get; set; }
         public Dictionary<string, List<List<string>>> clientAnswers { get; set; } = new Dictionary<string, List<List<string>>>();
-     
     }
     /// <summary>
     /// TimeLine.json
@@ -621,7 +620,7 @@ namespace TEAMModelOS.SDK.Models
         // public int EventId { get; set; }
         /// <summary>
         /// 事件
-        /// 推送相关 在Push.json处理 DifObjPush 推送给学生 差异化推送   "PushMemberId":[1,4,8,12,17,18,19,23,24,27,32,36]  ,FastPgPush 一推送
+        /// 推送相关 在Push.json处理 DifObjPush 推送给学生 差异化推送   "PushMemberId":[1,4,8,12,17,18,19,23,24,27,32,36]  ,FastPgPush 一推送
         /// 互动相关 在IRS.json处理 'PopQuesLoad'互动问答 , 'ReAtmpAnsStrt' 二次作答 , 'BuzrAns'  抢权(新), 'BuzrLoad'抢权(旧), PickupResult   挑人算不算互动??  读取PickupMemberId "[\r\n  35\r\n]"
         /// 测验相关 在IRS.json处理 SPQStrt 测验模式
         /// 任务相关 在Task.json处理 'WrkSpaceLoad' 作品收集, 'WrkCmp' 作品贴上  是什么操作
@@ -654,6 +653,10 @@ namespace TEAMModelOS.SDK.Models
         /// 挑人的类型
         /// </summary>
         public string PickupType { get; set; }
+        /// <summary>
+        /// 课中评测的id
+        /// </summary>
+        public string ExamId { get; set; }
     }
     public class LearningCategory {
         /// <summary>