Commit c8e61086 authored by 黄奎's avatar 黄奎

页面修改

parent ac5e2d2d
......@@ -105,7 +105,7 @@ WHERE 1=1
Score_Value = item.Score_value,
HomeWorkStatus = item.status,
ThName = item.th_name,
Stu_HomeWork_Id=item.stu_homework_id,
Stu_HomeWork_Id = item.stu_homework_id,
});
RowNum++;
}
......@@ -113,7 +113,7 @@ WHERE 1=1
//课程配置评论列表
var courseCommentModel = courseCommentRepository.GetCourseCommentListRepository(new CourseQuery() { QCourseIds = query.CourseId.ToString() }).FirstOrDefault();
//学员评论列表
var commentList= stuCommentRepository.GetStuCommentListRepository(new CourseQuery() { CourseId = query.CourseId, StuIds = query.StuIds });
var commentList = stuCommentRepository.GetStuCommentListRepository(new CourseQuery() { CourseId = query.CourseId, StuIds = query.StuIds });
ExamWorkResult firstComment = null;
ExamWorkResult secondComment = null;
......@@ -121,176 +121,132 @@ WHERE 1=1
string info;
if (homeWorkList != null && homeWorkList.Count > 0)
{
//第一次评价
if (homeWorkList.Count >= 5)
{
var firstList = homeWorkList.Where(qitem => qitem.RowNum <= 5).ToList();
var firstScore = firstList.Average(qitem => qitem.Score_p) * 100;
info = "";
var commentModel = commentRepository.GetComment(firstScore);
if (courseCommentModel != null && courseCommentModel.CommentDetails != null && courseCommentModel.CommentDetails.Count() > 0)
var firstFlag= firstList.Where(qitem => qitem.HomeWorkStatus == 0).Count() > 0;
//第一阶段有未提交的作业就不生成系统评价
if (!firstFlag)
{
var tempModel = courseCommentModel.CommentDetails.Where(qitem => qitem.StartNum <= firstScore && firstScore < qitem.EndNum)?.FirstOrDefault();
if (tempModel != null)
{
info = tempModel?.Info ?? "";
}
else
{
info = commentModel?.Info ?? "";
}
}
else
{
info = commentModel?.Info ?? "";
}
if (commentList?.Where(qitem => qitem.CourseId == qitem.CourseId && qitem.HomeWorkId == firstList.LastOrDefault().Stu_HomeWork_Id && qitem.CreateType == 1).Count() > 0)
{
var tempModel = commentList.Where(qitem => qitem.CourseId == qitem.CourseId && qitem.HomeWorkId == firstList.LastOrDefault().Stu_HomeWork_Id && qitem.CreateType == 1).FirstOrDefault();
var firstScore = firstList.Average(qitem => qitem.Score_p) * 100;
string title = firstList.LastOrDefault().ThName + "老师的评语";
info = GetCommentInfo(courseCommentModel, firstScore);
var First_Stu_HomeWork_Id = firstList.LastOrDefault().Stu_HomeWork_Id;
var tempModel = GetSystemCreateComment(commentList, query.CourseId, First_Stu_HomeWork_Id);
firstComment = new ExamWorkResult()
{
CreateTime = tempModel.CreateTime,
ResultType = 3,
Title = firstList.LastOrDefault().ThName + "老师的评语",
Comment = tempModel?.Info
};
}
else
{
firstComment = new ExamWorkResult()
{
CreateTime = firstList.LastOrDefault().CreateTime.AddMinutes(1),
ResultType = 3,
Title = firstList.LastOrDefault().ThName + "老师的评语",
Comment = info
};
stuCommentRepository.SetStuCommentRepository(new RB_Stu_Comment()
{
Id = 0,
HomeWorkId = firstList.LastOrDefault().Stu_HomeWork_Id,
StuUid = Convert.ToInt32(query.StuIds),
CourseId = query.CourseId,
Times = 1,
Info = info,
CreateType = 1,
CreateByName = firstList.LastOrDefault().ThName,
CreateTime = firstList.LastOrDefault().CreateTime.AddMinutes(1),
});
}
}
if (homeWorkList.Count >= 9)
{
var secondList = homeWorkList.Where(qitem => qitem.RowNum > 5 && qitem.RowNum <= 9).ToList();
var secondScore = secondList.Average(qitem => qitem.Score_p) * 100;
info = "";
var commentModel = commentRepository.GetComment(secondScore);
if (courseCommentModel != null && courseCommentModel.CommentDetails != null && courseCommentModel.CommentDetails.Count() > 0)
{
var tempModel = courseCommentModel.CommentDetails.Where(qitem => qitem.StartNum <= secondScore && secondScore < qitem.EndNum)?.FirstOrDefault();
if (tempModel != null)
{
info = tempModel?.Info ?? "";
firstComment.CreateTime = tempModel.CreateTime;
firstComment.Comment = tempModel.Info;
}
else
{
info = commentModel?.Info ?? "";
var firstNum = CreateRandomNum();
firstComment.CreateTime = firstList.LastOrDefault().CreateTime.AddMinutes(firstNum);
firstComment.Comment = info;
//新增系统生成评价
stuCommentRepository.SetStuCommentRepository(new RB_Stu_Comment()
{
Id = 0,
HomeWorkId = First_Stu_HomeWork_Id,
StuUid = Convert.ToInt32(query.StuIds),
CourseId = query.CourseId,
Times = 1,
Info = info,
CreateType = 1,
CreateByName = firstList.LastOrDefault().ThName,
CreateTime = firstComment.CreateTime,
});
}
}
else
{
info = commentModel?.Info ?? "";
}
if (commentList?.Where(qitem => qitem.CourseId == qitem.CourseId && qitem.HomeWorkId == secondList.LastOrDefault().Stu_HomeWork_Id && qitem.CreateType == 1).Count() > 0)
{
var tempModel = commentList.Where(qitem => qitem.CourseId == qitem.CourseId && qitem.HomeWorkId == secondList.LastOrDefault().Stu_HomeWork_Id && qitem.CreateType == 1).FirstOrDefault();
secondComment = new ExamWorkResult()
{
CreateTime = tempModel.CreateTime,
ResultType = 3,
Title = secondList.LastOrDefault().ThName + "老师的评语",
Comment = tempModel?.Info
};
}
else
}
//第二次评价
if (homeWorkList.Count >= 9)
{
var secondList = homeWorkList.Where(qitem => qitem.RowNum > 5 && qitem.RowNum <= 9).ToList();
var secondFlag = secondList.Where(qitem => qitem.HomeWorkStatus == 0).Count() > 0;
if (!secondFlag)
{
var secondScore = secondList.Average(qitem => qitem.Score_p) * 100;
info = GetCommentInfo(courseCommentModel, secondScore);
var Second_Stu_HomeWork_Id = secondList.LastOrDefault().Stu_HomeWork_Id;
var secondModel = GetSystemCreateComment(commentList, query.CourseId, Second_Stu_HomeWork_Id);
secondComment = new ExamWorkResult()
{
CreateTime = secondList.LastOrDefault().CreateTime.AddMinutes(1),
ResultType = 3,
Title = secondList.LastOrDefault().ThName + "老师的评语",
Comment = info,
};
stuCommentRepository.SetStuCommentRepository(new RB_Stu_Comment()
if (secondModel != null)
{
Id = 0,
HomeWorkId = secondList.LastOrDefault().Stu_HomeWork_Id,
StuUid = Convert.ToInt32(query.StuIds),
CourseId = query.CourseId,
Times = 2,
Info = info,
CreateType = 1,
CreateByName = secondList.LastOrDefault().ThName,
CreateTime = secondList.LastOrDefault().CreateTime.AddMinutes(1),
});
}
}
if (homeWorkList.Count >= 13)
{
var thirdList = homeWorkList.Where(qitem => qitem.RowNum > 9&&qitem.RowNum<=13).ToList();
var thirdScore = thirdList.Average(qitem => qitem.Score_p) * 100;
info = "";
var commentModel = commentRepository.GetComment(thirdScore);
if (courseCommentModel != null && courseCommentModel.CommentDetails != null && courseCommentModel.CommentDetails.Count() > 0)
{
var tempModel = courseCommentModel.CommentDetails.Where(qitem => qitem.StartNum <= thirdScore && thirdScore < qitem.EndNum)?.FirstOrDefault();
if (tempModel != null)
{
info = tempModel?.Info ?? "";
secondComment.CreateTime = secondModel.CreateTime;
secondComment.Comment = secondModel.Info;
}
else
{
info = commentModel?.Info ?? "";
var secondNum = CreateRandomNum();
secondComment.CreateTime = secondList.LastOrDefault().CreateTime.AddMinutes(secondNum);
secondComment.Comment = info;
stuCommentRepository.SetStuCommentRepository(new RB_Stu_Comment()
{
Id = 0,
HomeWorkId = Second_Stu_HomeWork_Id,
StuUid = Convert.ToInt32(query.StuIds),
CourseId = query.CourseId,
Times = 2,
Info = info,
CreateType = 1,
CreateByName = secondList.LastOrDefault().ThName,
CreateTime = secondComment.CreateTime,
});
}
}
else
{
info = commentModel?.Info ?? "";
}
if (commentList?.Where(qitem => qitem.CourseId == qitem.CourseId && qitem.HomeWorkId == thirdList.LastOrDefault().Stu_HomeWork_Id && qitem.CreateType == 1).Count() > 0)
}
//第三次评价
if (homeWorkList.Count >= 13)
{
var thirdList = homeWorkList.Where(qitem => qitem.RowNum > 9 && qitem.RowNum <= 13).ToList();
var thirdFlag = thirdList.Where(qitem => qitem.HomeWorkStatus == 0).Count() > 0;
if (!thirdFlag)
{
var tempModel = commentList.Where(qitem => qitem.CourseId == qitem.CourseId && qitem.HomeWorkId == thirdList.LastOrDefault().Stu_HomeWork_Id && qitem.CreateType == 1).FirstOrDefault();
var thirdScore = thirdList.Average(qitem => qitem.Score_p) * 100;
info = GetCommentInfo(courseCommentModel, thirdScore);
var Third_Stu_HomeWork_Id = thirdList.LastOrDefault().Stu_HomeWork_Id;
var thirdModel = GetSystemCreateComment(commentList, query.CourseId, Third_Stu_HomeWork_Id);
thirdComment = new ExamWorkResult()
{
CreateTime = tempModel.CreateTime,
ResultType = 3,
Title = thirdList.LastOrDefault().ThName + "老师的评语",
Comment = tempModel?.Info
};
}
else
{
thirdComment = new ExamWorkResult()
if (thirdModel != null)
{
CreateTime = thirdList.LastOrDefault().CreateTime.AddMinutes(1),
ResultType = 3,
Title = thirdList.LastOrDefault().ThName + "老师的评语",
Comment = info,
};
stuCommentRepository.SetStuCommentRepository(new RB_Stu_Comment()
thirdComment.CreateTime = thirdModel.CreateTime;
thirdComment.Comment = thirdModel.Info;
}
else
{
Id = 0,
HomeWorkId = thirdList.LastOrDefault().Stu_HomeWork_Id,
StuUid = Convert.ToInt32(query.StuIds),
CourseId = query.CourseId,
Times = 3,
Info = info,
CreateType = 1,
CreateByName = thirdList.LastOrDefault().ThName,
CreateTime = thirdList.LastOrDefault().CreateTime.AddMinutes(1),
});
var thirdNum = CreateRandomNum();
thirdComment.CreateTime = thirdList.LastOrDefault().CreateTime.AddMinutes(thirdNum);
thirdComment.Comment = info;
stuCommentRepository.SetStuCommentRepository(new RB_Stu_Comment()
{
Id = 0,
HomeWorkId = Third_Stu_HomeWork_Id,
StuUid = Convert.ToInt32(query.StuIds),
CourseId = query.CourseId,
Times = 3,
Info = info,
CreateType = 1,
CreateByName = thirdList.LastOrDefault().ThName,
CreateTime = thirdComment.CreateTime,
});
}
}
}
}
......@@ -329,5 +285,57 @@ WHERE 1=1
}
return list;
}
/// <summary>
/// 生成随机数
/// </summary>
/// <returns></returns>
private int CreateRandomNum()
{
Random rnd = new Random();
return rnd.Next(5, 20);
}
/// <summary>
/// 获取系统生成的评论
/// </summary>
/// <param name="commentList"></param>
/// <param name="CourseId"></param>
/// <param name="Stu_HomeWork_Id"></param>
/// <returns></returns>
private RB_Stu_Comment GetSystemCreateComment(List<RB_Stu_Comment> commentList,int CourseId,int Stu_HomeWork_Id)
{
var tempModel = commentList.Where(qitem => qitem.CourseId == qitem.CourseId && qitem.HomeWorkId == Stu_HomeWork_Id && qitem.CreateType == 1).FirstOrDefault();
return tempModel;
}
/// <summary>
/// 获取课程评论或自定义评论
/// </summary>
/// <param name="courseCommentModel">课程评价配置</param>
/// <param name="Score">平均分数</param>
/// <returns></returns>
private string GetCommentInfo(RB_Course_Comment_Extend courseCommentModel, decimal Score)
{
string info = "";
var commentModel = commentRepository.GetComment(Score);
if (courseCommentModel != null && courseCommentModel.CommentDetails != null && courseCommentModel.CommentDetails.Count() > 0)
{
var tempModel = courseCommentModel.CommentDetails.Where(qitem => qitem.StartNum <= Score && Score < qitem.EndNum)?.FirstOrDefault();
if (tempModel != null)
{
info = tempModel?.Info ?? "";
}
else
{
info = commentModel?.Info ?? "";
}
}
else
{
info = commentModel?.Info ?? "";
}
return info;
}
}
}
......@@ -138,7 +138,7 @@ namespace EduSpider.Services
if (dataList != null && dataList.Count > 0)
{
dataList = dataList.OrderBy(qitem => qitem.CreateTime).ToList();
dataList = dataList.OrderByDescending(qitem => qitem.CreateTime).ToList();
var firstModel = dataList.FirstOrDefault();
foreach (var item in dataList)
{
......
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