Commit 75be3f9e authored by 黄奎's avatar 黄奎

111

parent 9f18c3ca
...@@ -131,46 +131,49 @@ WHERE 1=1 ...@@ -131,46 +131,49 @@ WHERE 1=1
CourseId = model.CourseId, CourseId = model.CourseId,
QHomeWorkIds= model.Details[0].HomeWorkIds, QHomeWorkIds= model.Details[0].HomeWorkIds,
}); });
var courseComment = new RB_Course_Comment_Extend(); if (homeworkList != null && homeworkList.Count > 0)
var defaultComment = new RB_Comment_Extend();
if (IsDefault == 1)
{ {
defaultComment = new CommentRepository().GetCommentListRepository(new CourseQuery() { DefaultCommentId = CommentId }).FirstOrDefault(); var courseComment = new RB_Course_Comment_Extend();
} var defaultComment = new RB_Comment_Extend();
else
{
courseComment = new CourseCommentRepository().GetCourseCommentListRepository(new CourseQuery() { CourseId = model.CourseId }).Where(qitem => qitem.Id == CommentId).FirstOrDefault();
}
foreach (var item in model.Details)
{
var tempList = homeworkList.Where(qitem => qitem.student_uid == item.StuUid).ToList();
item.CreateTime = tempList.LastOrDefault().add_time.AddSeconds(1);
var Score = tempList.Average(qitem => qitem.score_p) * 100;
string info = "";
if (IsDefault == 1) if (IsDefault == 1)
{ {
if (defaultComment != null && defaultComment.Details != null && defaultComment.Details.Count > 0) defaultComment = new CommentRepository().GetCommentListRepository(new CourseQuery() { DefaultCommentId = CommentId }).FirstOrDefault();
}
else
{
courseComment = new CourseCommentRepository().GetCourseCommentListRepository(new CourseQuery() { CourseId = model.CourseId }).Where(qitem => qitem.Id == CommentId).FirstOrDefault();
}
foreach (var item in model.Details)
{
var tempList = homeworkList.Where(qitem => qitem.student_uid == item.StuUid).ToList();
item.CreateTime = tempList.LastOrDefault().add_time.AddSeconds(1);
var Score = tempList.Average(qitem => qitem.score_p) * 100;
string info = "";
if (IsDefault == 1)
{ {
var tempModel = defaultComment.Details.Where(qitem => qitem.StartNum <= Score && Score < qitem.EndNum)?.FirstOrDefault(); if (defaultComment != null && defaultComment.Details != null && defaultComment.Details.Count > 0)
if (tempModel != null)
{ {
info = tempModel?.Info ?? ""; var tempModel = defaultComment.Details.Where(qitem => qitem.StartNum <= Score && Score < qitem.EndNum)?.FirstOrDefault();
if (tempModel != null)
{
info = tempModel?.Info ?? "";
}
} }
} }
} else
else
{
if (courseComment != null && courseComment.CommentDetails != null && courseComment.CommentDetails.Count > 0)
{ {
var tempModel = courseComment.CommentDetails.Where(qitem => qitem.StartNum <= Score && Score < qitem.EndNum)?.FirstOrDefault(); if (courseComment != null && courseComment.CommentDetails != null && courseComment.CommentDetails.Count > 0)
if (tempModel != null)
{ {
info = tempModel?.Info ?? ""; var tempModel = courseComment.CommentDetails.Where(qitem => qitem.StartNum <= Score && Score < qitem.EndNum)?.FirstOrDefault();
if (tempModel != null)
{
info = tempModel?.Info ?? "";
}
} }
} }
item.Info = info;
} }
item.Info = info;
} }
} }
flag = SetStuCommentRepository(model,IsAdd:true); flag = SetStuCommentRepository(model,IsAdd:true);
......
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