Commit 92a18ae3 authored by liudong1993's avatar liudong1993

1

parent 974644a5
...@@ -143,6 +143,11 @@ namespace EduSpider.Model.Extend ...@@ -143,6 +143,11 @@ namespace EduSpider.Model.Extend
/// </summary> /// </summary>
public int ExamScoreId { get; set; } public int ExamScoreId { get; set; }
/// <summary>
/// 考试类型
/// </summary>
public int ExamType { get; set; }
/// <summary> /// <summary>
/// 教师姓名 /// 教师姓名
/// </summary> /// </summary>
......
...@@ -42,6 +42,11 @@ namespace EduSpider.Model.Extend ...@@ -42,6 +42,11 @@ namespace EduSpider.Model.Extend
/// 一试排名 /// 一试排名
/// </summary> /// </summary>
public int ARank { get; set; } public int ARank { get; set; }
/// <summary>
/// 考试类型
/// </summary>
public int ExamType { get; set; }
} }
/// <summary> /// <summary>
......
...@@ -24,7 +24,7 @@ namespace EduSpider.Repository ...@@ -24,7 +24,7 @@ namespace EduSpider.Repository
{ {
StringBuilder builder = new(); StringBuilder builder = new();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT A.*,B.ExamName,B.CreateTime AS ExamCreateTime SELECT A.*,B.ExamName,B.CreateTime AS ExamCreateTime,B.Type as ExamType
FROM RB_Exam_Score AS A INNER JOIN rb_exam AS B ON A.ExamId=B.ExamId FROM RB_Exam_Score AS A INNER JOIN rb_exam AS B ON A.ExamId=B.ExamId
WHERE 1=1 and B.Status =0 WHERE 1=1 and B.Status =0
"); ");
......
...@@ -152,6 +152,7 @@ namespace EduSpider.Services ...@@ -152,6 +152,7 @@ namespace EduSpider.Services
ExamRankRate = item.RankRate, ExamRankRate = item.RankRate,
ExamId = item.ExamId, ExamId = item.ExamId,
ExamScoreId = item.Id, ExamScoreId = item.Id,
ExamType = item.ExamType
}); });
} }
} }
...@@ -188,6 +189,7 @@ namespace EduSpider.Services ...@@ -188,6 +189,7 @@ namespace EduSpider.Services
item.ExamRankRate, item.ExamRankRate,
item.ExamId, item.ExamId,
item.ExamScoreId, item.ExamScoreId,
item.ExamType
}; };
} }
//评语 //评语
......
...@@ -463,13 +463,15 @@ namespace EduSpider.Services ...@@ -463,13 +463,15 @@ namespace EduSpider.Services
public string SetExamStatAnalysis(int courseId, UserInfo userInfo) public string SetExamStatAnalysis(int courseId, UserInfo userInfo)
{ {
//获取所有分组考试 //获取所有分组考试
var examList = ExamRepository.GetExamList(new RB_Exam_Extend() { CourseId = courseId, CreateBy = userInfo.Id, Type = 2 }).OrderBy(x => x.ExamId).ToList(); var examList = ExamRepository.GetExamList(new RB_Exam_Extend() { CourseId = courseId, Type = 2 }).OrderBy(x => x.ExamId).ToList();
if (!examList.Any()) { return "未查询到分组考试信息,无法生成统计分析"; } if (!examList.Any()) { return "未查询到分组考试信息,无法生成统计分析"; }
//查询所有的 考试题 //查询所有的 考试题
string examIds = string.Join(",", examList.Select(x => x.ExamId)); string examIds = string.Join(",", examList.Select(x => x.ExamId));
var questList = Exam_QuestionsRepository.GetList(new RB_Exam_Questions_Extend() { ExamIds = examIds }); var questList = Exam_QuestionsRepository.GetList(new RB_Exam_Questions_Extend() { ExamIds = examIds });
//查询所有的 学生分数 //查询所有的 学生分数
var scoreList = Exam_ScoreRepository.GetList(new RB_Exam_Score_Extend() { ExamIds = examIds }); var scoreList = Exam_ScoreRepository.GetList(new RB_Exam_Score_Extend() { ExamIds = examIds });
scoreList = scoreList.Where(x => x.StuId > 0).ToList();
examList = examList.Where(y => scoreList.Select(x => x.ExamId).Contains(y.ExamId)).ToList();
foreach (var item in scoreList) { foreach (var item in scoreList) {
item.ScoreList = JsonHelper.Deserialize<List<ExamQScoreModel>>(item.Content); item.ScoreList = JsonHelper.Deserialize<List<ExamQScoreModel>>(item.Content);
foreach (var qitem in item.ScoreList) foreach (var qitem in item.ScoreList)
...@@ -500,6 +502,8 @@ namespace EduSpider.Services ...@@ -500,6 +502,8 @@ namespace EduSpider.Services
}); });
if (ExamId > 0) { if (ExamId > 0) {
try
{
List<int> StuIdList = scoreList.Select(x => x.StuId).Distinct().ToList(); List<int> StuIdList = scoreList.Select(x => x.StuId).Distinct().ToList();
int stuNum = StuIdList.Count(); int stuNum = StuIdList.Count();
...@@ -699,6 +703,12 @@ namespace EduSpider.Services ...@@ -699,6 +703,12 @@ namespace EduSpider.Services
} }
#endregion #endregion
} }
catch (Exception ex)
{
LogHelper.WriteError("SetExamStatAnalysis", "", ex);
return "出错了,请联系管理员";
}
}
return ExamId > 0 ? "" : "出错了,请联系管理员"; return ExamId > 0 ? "" : "出错了,请联系管理员";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment