|
@@ -7,6 +7,8 @@ using TEAMModelOS.SDK.Models;
|
|
|
using TEAMModelOS.SDK.Extension;
|
|
|
using StackExchange.Redis;
|
|
|
using System.Text.RegularExpressions;
|
|
|
+using System.Linq;
|
|
|
+using static TEAMModelOS.SDK.Models.Cosmos.Student.StudentAnalysis;
|
|
|
|
|
|
namespace HTEX.Test.Controllers
|
|
|
{
|
|
@@ -18,7 +20,7 @@ namespace HTEX.Test.Controllers
|
|
|
private readonly AzureCosmosFactory _azureCosmos;
|
|
|
private readonly AzureStorageFactory _azureStorage;
|
|
|
|
|
|
-
|
|
|
+ private readonly List<string> objectiveTypes=new List<string>(){ "single", "multiple", "sortmultiple" , "judge" };
|
|
|
public LessonRecordController(ILogger<LessonRecordController> logger, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage)
|
|
|
{
|
|
|
_logger = logger;
|
|
@@ -205,7 +207,7 @@ namespace HTEX.Test.Controllers
|
|
|
/// <param name="lessonBase"></param>
|
|
|
/// <param name="irsDatas"></param>
|
|
|
/// <returns></returns>
|
|
|
- private async Task<List<StudentLessonData>> GetIRSData(LessonRecord lessonRecord, LessonBase lessonBase, TimeLineData timeLineData, List<IRSData> irsDatas, List<StudentLessonData> studentLessonDatas)
|
|
|
+ private List<StudentLessonData> GetIRSData(LessonRecord lessonRecord, LessonBase lessonBase, TimeLineData timeLineData, List<IRSData> irsDatas, List<StudentLessonData> studentLessonDatas)
|
|
|
{
|
|
|
List<string> interactTypes = new List<string>() { "PopQuesLoad", "ReAtmpAnsStrt", "BuzrAns", "BuzrLoad", "PickupResult" };
|
|
|
//去重页面
|
|
@@ -270,7 +272,7 @@ namespace HTEX.Test.Controllers
|
|
|
return studentLessonDatas;
|
|
|
}
|
|
|
|
|
|
- private static void ProcessIRSPageData(List<IRSData> irsDatas, List<StudentLessonData> studentLessonDatas, dynamic item)
|
|
|
+ private static List<StudentLessonData> ProcessIRSPageData(List<IRSData> irsDatas, List<StudentLessonData> studentLessonDatas, dynamic item)
|
|
|
{
|
|
|
var irsDataPages = irsDatas.Where(y => item.key.Equals(y.pageID));
|
|
|
foreach (var irsDataPage in irsDataPages)
|
|
@@ -434,7 +436,9 @@ namespace HTEX.Test.Controllers
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+ return studentLessonDatas;
|
|
|
}
|
|
|
|
|
|
private static (double weight,string reultType) GetInteractResultHasAnswer(List<string>? answers, List<string> ans0 , bool objective,string type)
|
|
@@ -645,40 +649,96 @@ namespace HTEX.Test.Controllers
|
|
|
/// <param name="coworkDatas"></param>
|
|
|
/// <param name="studentLessonDatas"></param>
|
|
|
/// <returns></returns>
|
|
|
- private async Task<dynamic> GetExamData(LessonRecord lessonRecord, LessonBase lessonBase, TimeLineData timeLineData, List<ExamData> examDatas, List<StudentLessonData> studentLessonDatas)
|
|
|
+ private List<StudentLessonData> GetExamData(LessonRecord lessonRecord, LessonBase lessonBase, TimeLineData timeLineData, List<ExamData> examDatas, List<StudentLessonData> studentLessonDatas)
|
|
|
{
|
|
|
foreach (var examData in examDatas)
|
|
|
{
|
|
|
- var allocation= examData?.exam?.papers?.SelectMany(x => x.point).Sum();
|
|
|
+ //直接取第一个元素的试卷,因为在HiTeach中,只会是一个试卷(一个科目),一个班参与。
|
|
|
+ var allocation= examData?.exam?.papers?.FirstOrDefault()?.point?.Sum();
|
|
|
var answersStd = examData?.exam?.papers?.FirstOrDefault()?.answers;
|
|
|
List<List<string>> answers= new List<List<string>>();
|
|
|
- if (answersStd!=null)
|
|
|
+ if (answersStd!=null)
|
|
|
{
|
|
|
- answersStd.ForEach(x =>
|
|
|
- {
|
|
|
- List<string> ans = new List<string>();
|
|
|
- x.ForEach(y =>
|
|
|
+ answersStd.ForEach(x => //去除[""]此种类型的标准答案,转为[]
|
|
|
{
|
|
|
- if (string.IsNullOrWhiteSpace(y))
|
|
|
+ List<string> ans = new List<string>();
|
|
|
+ if (x.Count!=0)
|
|
|
{
|
|
|
-
|
|
|
+ if (x.Count==1)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrWhiteSpace(x[0]))
|
|
|
+ {
|
|
|
+ answers.Add(ans);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ answers.Add(x);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ answers.Add(x);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ answers.Add(ans);
|
|
|
}
|
|
|
});
|
|
|
- answers.Add(ans);
|
|
|
- });
|
|
|
}
|
|
|
examData?.examClassResult?.ForEach(item =>{
|
|
|
+ //学生下标
|
|
|
int index = 0;
|
|
|
- item.studentAnswersArray.ForEach(x => {
|
|
|
- //是否要判断主观题或者客观题, 多套试卷,有主观题的
|
|
|
- //主观题有回答的:608942756458532864\Clients\18782481024\Ans\27-4341670635487887360-examExchangeAnswerlist 27 从1开始的学生序号-4341670635487887360评测编号,内容qNo 是从1开始的题号。
|
|
|
- if (x.IsNotEmpty())
|
|
|
- {
|
|
|
- }
|
|
|
- });
|
|
|
+ if (item.studentAnswersArray.Count()>0
|
|
|
+ && item.studentAnswersArray.Count() == item.studentIds.Count() //学生作答数量和学生id数量一致
|
|
|
+ && item.studentScores.Count()==item.studentIds.Count()) //学生分数和学生id数量一致
|
|
|
+ {
|
|
|
+ item.studentAnswersArray.ForEach(stu => {
|
|
|
+
|
|
|
+ var student = studentLessonDatas.Find(x => x.id!.Equals(item.studentIds[index]));
|
|
|
+
|
|
|
+ if (student!=null)
|
|
|
+ {
|
|
|
+
|
|
|
+ //是否要判断主观题或者客观题, 多套试卷,有主观题的
|
|
|
+ //,如果没获得结果,
|
|
|
+ //主观题有回答的:608942756458532864\Clients\18782481024\Ans\27-4341670635487887360-examExchangeAnswerlist
|
|
|
+ //27 从1开始的学生序号-4341670635487887360评测编号,内容qNo 是从1开始的题号。
|
|
|
+ if (stu.IsNotEmpty() && answers.Count()==stu.Count && examData.exam.papers[0].type.Count()==answers.Count )
|
|
|
+ {
|
|
|
+ StudentExamRecord studentExam = new StudentExamRecord();
|
|
|
+ var studentScore = item.studentScores[index];
|
|
|
+ List<InteractRecord> answerRecords = new List<InteractRecord>();
|
|
|
+ //题目下标
|
|
|
+ int itemIndex = 0;
|
|
|
+ stu.ForEach(ans =>
|
|
|
+ {
|
|
|
+ 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);
|
|
|
+ InteractRecord interactRecord = new InteractRecord()
|
|
|
+ {
|
|
|
+ interactType="SPQStrt",//类型
|
|
|
+ resultType=res.reultType,//作答结果类型
|
|
|
+ resultWeight=res.weight,//得分权重
|
|
|
+ criterion= score,//标准分
|
|
|
+ interactScore= studentScore[itemIndex]//得分
|
|
|
+ };
|
|
|
+ answerRecords.Add(interactRecord);
|
|
|
+ });
|
|
|
+ studentExam.score= answerRecords.Where(x => x.interactScore>=0).Select(x => x.interactScore).Sum();//得分
|
|
|
+ studentExam.scoreRate= allocation.HasValue && allocation.Value>0 ? studentExam.score * 1.0/allocation.Value : 0;//得分率
|
|
|
+ studentExam.answerRate= answerRecords.Where(x => x.resultWeight>0).Count()*1.0/studentScore.Count();//作答率
|
|
|
+ studentExam.examId=examData.exam.id;
|
|
|
+ studentExam.itemRecords=answerRecords;
|
|
|
+ student.examRecords.Add(studentExam);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
- return null;
|
|
|
+ return studentLessonDatas;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 协作参与率 态度计算
|
|
@@ -738,6 +798,18 @@ namespace HTEX.Test.Controllers
|
|
|
/// </summary>
|
|
|
public class StudentLessonData
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// 课例id
|
|
|
+ /// </summary>
|
|
|
+ public string? lessonId { get; set; }
|
|
|
+ /// <summary>
|
|
|
+ /// 课程id
|
|
|
+ /// </summary>
|
|
|
+ public string? courseId { get; set; }
|
|
|
+ /// <summary>
|
|
|
+ /// 科目id
|
|
|
+ /// </summary>
|
|
|
+ public string? subjectId { get; set; }
|
|
|
/// <summary>
|
|
|
/// 学生的学号
|
|
|
/// </summary>
|
|
@@ -785,7 +857,7 @@ namespace HTEX.Test.Controllers
|
|
|
/// <summary>
|
|
|
/// 作答率0 未作答,1,所有题目作答,小数点则表示部分作答。 可纳入学习态度计算, 主观题需要确认 是否会在此写入答案。
|
|
|
/// </summary>
|
|
|
- public int answerRate{ get; set; }
|
|
|
+ public double answerRate{ get; set; }
|
|
|
/// <summary>
|
|
|
/// 评测得分
|
|
|
/// </summary>
|
|
@@ -801,19 +873,19 @@ namespace HTEX.Test.Controllers
|
|
|
/// <summary>
|
|
|
/// 配分
|
|
|
/// </summary>
|
|
|
- // public double allocation { get; set; }
|
|
|
+ // public double allocation { get; set; }
|
|
|
/// <summary>
|
|
|
- /// 暂不计算
|
|
|
+ /// 暂不计算,取消{ get; set; }
|
|
|
/// 每个题的得分情况
|
|
|
/// </summary>
|
|
|
- // public List<double> itemScores { get; set; } = new List<double>();
|
|
|
+ public List<InteractRecord> itemRecords /*{ get; set; }*/ = new List<InteractRecord>();
|
|
|
}
|
|
|
|
|
|
public class InteractRecord
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
- /// { "PopQuesLoad", "ReAtmpAnsStrt", "BuzrAns", "BuzrLoad", "PickupResult" };
|
|
|
+ /// { "PopQuesLoad", "ReAtmpAnsStrt", "BuzrAns", "BuzrLoad", "PickupResult","SPQStrt" }; //"SPQStrt" 课中评测专用,不参与互动的统计,会重复
|
|
|
/// </summary>
|
|
|
public string? interactType { get; set; }
|
|
|
/// <summary>
|
|
@@ -824,10 +896,6 @@ namespace HTEX.Test.Controllers
|
|
|
/// 互动结果类型,如:T0没有作答, 没有参与,T1作答错误,有参加,有抢权,TP部分正确,TT作答正确,抢权成功,被抽到
|
|
|
/// </summary>
|
|
|
public string? resultType { get; set; }
|
|
|
- /// <summary>
|
|
|
- /// 互动结果分值
|
|
|
- /// </summary>
|
|
|
- //public double resultScore { get; set; }
|
|
|
/// <summary>
|
|
|
/// 互动积分,试题评分
|
|
|
/// </summary>
|