Commit 6d4cd255 authored by 黄奎's avatar 黄奎

页面修改

parent 71ad9eb9
......@@ -702,47 +702,94 @@ namespace Edu.Module.Exam
StudentId = StudentId,
};
sQuery.LevelType = query?.BankType ?? 0;
var finishList = student_PracticeRepository.GetStudentPracticeListRepository(sQuery);
if (finishList != null && finishList.Count > 0)
{
var tempReadingList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ReadingChoose)?.ToList();
readingFinishCount = tempReadingList?.Count() ?? 0;
readingStartId = tempReadingList != null && tempReadingList.Count > 0 ? (tempReadingList?.Max(qitem => qitem.QuestionId) ?? 0) : 0;
//if (readingStartId == readingFinishCount&& readingFinishCount>0)
//{
// readingStartId = 0;
// readingTimes = tempReadingList?.FirstOrDefault()?.Times ?? 1;
// readingFinishCount = 0;
//}
var tempListeningList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.ToList();
listeningFinishCount = tempListeningList?.Count() ?? 0;
listeningStartId = tempListeningList != null && tempListeningList.Count > 0 ? (tempListeningList?.Max(qitem => qitem.QuestionId) ?? 0) : 0;
var tempGrammarList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.ToList();
grammarFinishCount = tempGrammarList?.Count() ?? 0;
grammarStartId = tempGrammarList != null && tempGrammarList.Count > 0 ? (tempGrammarList?.Max(qitem => qitem.QuestionId) ?? 0) : 0;
var tempWordsList = finishList?.Where(qitem =>
qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseWord
|| qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseMean
|| qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseWordUse
)?.ToList();
wordsFinishCount = tempWordsList?.Count() ?? 0;
wordsStartId = tempWordsList != null && tempWordsList.Count > 0 ? (tempWordsList?.Max(qitem => qitem.QuestionId) ?? 0) : 0;
}
var list = questionRepository.GetQuestionCategoryListRepository(query);
if (list != null && list.Count > 0)
//问题列表
var questionList = questionRepository.GetQuestionCategoryListRepository(query);
if (questionList != null && questionList.Count > 0)
{
readingTotalCount = list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ReadingChoose)?.Sum(qitem => qitem.QuestionCount) ?? 0;
listeningTotalCount = list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.Sum(qitem => qitem.QuestionCount) ?? 0;
grammarTotalCount = list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.Sum(qitem => qitem.QuestionCount) ?? 0;
wordsTotalCount = list?.Where(qitem =>
readingTotalCount = questionList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ReadingChoose)?.Sum(qitem => qitem.QuestionCount) ?? 0;
listeningTotalCount = questionList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.Sum(qitem => qitem.QuestionCount) ?? 0;
grammarTotalCount = questionList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.Sum(qitem => qitem.QuestionCount) ?? 0;
wordsTotalCount = questionList?.Where(qitem =>
qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseWord
|| qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseMean
|| qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseWordUse
)?.Sum(qitem => qitem.QuestionCount) ?? 0;
}
//学员完成情况
var finishList = student_PracticeRepository.GetStudentPracticeListRepository(sQuery);
//阅读题练习完成列表
var tempReadingList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ReadingChoose)?.ToList();
//听力题练习完成列表
var tempListeningList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.ToList();
//语法题练习完成列表
var tempGrammarList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.ToList();
//单词题练习完成列表
var tempWordsList = finishList?.Where(qitem =>
qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseWord
|| qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseMean
|| qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseWordUse
)?.ToList();
if (tempReadingList != null && tempReadingList.Count > 0)
{
readingTimes = tempReadingList?.Max(qitem => qitem.Times) ?? 1;
readingFinishCount = tempReadingList?.Where(qitem => qitem.Times == readingTimes)?.Count() ?? 0;
if (tempReadingList?.Where(qitem => qitem.Times == readingTimes).Count() > 0)
{
readingStartId = tempReadingList?.Where(qitem => qitem.Times == readingTimes)?.Max(qitem => qitem.QuestionId) ?? 0;
}
if (readingFinishCount == readingTotalCount)
{
readingStartId = 0;
readingTimes = readingTimes + 1;
}
}
if (tempListeningList != null && tempListeningList.Count > 0)
{
listeningTimes = tempListeningList?.Max(qitem => qitem.Times) ?? 1;
listeningFinishCount = tempListeningList ?.Where(qitem => qitem.Times == listeningTimes)?.Count() ?? 0;
if (tempListeningList?.Where(qitem => qitem.Times == listeningTimes)?.Count() > 0)
{
listeningStartId = tempListeningList?.Where(qitem => qitem.Times == listeningTimes)?.Max(qitem => qitem.QuestionId) ?? 0;
}
if (listeningFinishCount == listeningFinishCount)
{
listeningStartId = 0;
listeningTimes = listeningTimes + 1;
}
}
if (tempGrammarList != null && tempGrammarList.Count > 0)
{
grammarTimes= tempGrammarList?.Max(qitem => qitem.Times) ?? 1;
grammarFinishCount = tempGrammarList?.Where(qitem => qitem.Times == grammarTimes).Count() ?? 0;
if (tempGrammarList?.Where(qitem => qitem.Times == grammarTimes).Count() > 0)
{
grammarStartId = tempGrammarList?.Where(qitem => qitem.Times == grammarTimes)?.Max(qitem => qitem.QuestionId) ?? 0;
}
if (grammarFinishCount == grammarTotalCount)
{
grammarStartId = 0;
grammarTimes = grammarTimes + 1;
}
}
if (tempWordsList != null && tempWordsList.Count > 0)
{
wordsTimes = tempWordsList?.Max(qitem => qitem.Times) ?? 1;
wordsFinishCount = tempWordsList?.Where(qitem=>qitem.Times== wordsTimes)?.Count() ?? 0;
if (tempWordsList?.Where(qitem => qitem.Times == wordsTimes)?.Count() > 0)
{
wordsStartId = tempWordsList?.Where(qitem => qitem.Times == wordsTimes)?.Max(qitem => qitem.QuestionId) ?? 0;
}
if (wordsFinishCount == wordsTotalCount )
{
wordsStartId = 0;
wordsTimes = wordsTimes + 1;
}
}
obj = new
{
readingFinishCount,
......@@ -1044,27 +1091,28 @@ namespace Edu.Module.Exam
public bool SetStudentPracticeModule(RB_Student_Practice_Extend model)
{
bool flag = false;
var oldModel = student_PracticeRepository.GetStudentPracticeListRepository(new RB_Student_Practice_Extend()
{
StudentId = model.StudentId,
QuestionId = model.QuestionId
})?.FirstOrDefault();
model.Id = oldModel?.Id ?? 0;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_Practice_Extend.IsAnswer),model.IsAnswer },
{nameof(RB_Student_Practice_Extend.IsWrong),model.IsWrong },
};
flag = student_PracticeRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Practice_Extend.Id), model.Id));
}
else
{
var newId = student_PracticeRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
//var oldModel = student_PracticeRepository.GetStudentPracticeListRepository(new RB_Student_Practice_Extend()
//{
// StudentId = model.StudentId,
// QuestionId = model.QuestionId
//})?.FirstOrDefault();
//model.Id = oldModel?.Id ?? 0;
//if (model.Id > 0)
//{
// Dictionary<string, object> fileds = new Dictionary<string, object>()
// {
// {nameof(RB_Student_Practice_Extend.IsAnswer),model.IsAnswer },
// {nameof(RB_Student_Practice_Extend.IsWrong),model.IsWrong },
// };
// flag = student_PracticeRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Practice_Extend.Id), model.Id));
//}
//else
//{
//}
var newId = student_PracticeRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
return flag;
}
......@@ -1138,26 +1186,6 @@ namespace Edu.Module.Exam
}
}
}
//int totalPage = 0;
//int pageSize = 30;
//if (model.ExamDetailsList.Count % pageSize == 0)
//{
// totalPage = model.ExamDetailsList.Count % pageSize;
//}
//else
//{
// totalPage = model.ExamDetailsList.Count % pageSize + 1;
//}
//int pageIndex = 1;
//while (pageIndex <= totalPage)
//{
// var tempList = model.ExamDetailsList.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList();
// if (tempList != null && tempList.Count > 0)
// {
// // flag = student_ExamDetailsRepository.BatchStudentExamDetailsRepository(tempList);
// }
//}
flag = student_ExamDetailsRepository.BatchStudentExamDetailsRepository(model.ExamDetailsList);
totalScore = model.ExamDetailsList.Sum(qitem => qitem.StudentScore);
}
......
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