Commit e0fce697 authored by 黄奎's avatar 黄奎

页面修改

parent bd91a5c0
......@@ -281,16 +281,16 @@ namespace Edu.Module.Exam
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <param name="ChapterId">当前章节编号</param>
/// <param name="PrevChapterId">上一章节编号</param>
/// <param name="ReviewChapterId">复习章节编号</param>
/// <returns></returns>
public object GetStudyCourseWords(int CourseId, int ChapterId, int PrevChapterId)
public object GetStudyCourseWords(int CourseId, int ChapterId, int ReviewChapterId)
{
List<object> list = new List<object>();
List<object> reviewList = new List<object>();
var dataList = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
{
CourseId = CourseId,
QChapterIds = ChapterId+","+ PrevChapterId
QChapterIds = ChapterId+","+ ReviewChapterId
});
if (dataList != null && dataList.Count > 0)
{
......@@ -310,7 +310,7 @@ namespace Edu.Module.Exam
});
}
foreach (var item in dataList.Where(qitem => qitem.ChapterId == PrevChapterId))
foreach (var item in dataList.Where(qitem => qitem.ChapterId == ReviewChapterId))
{
reviewList.Add(new
{
......@@ -333,16 +333,6 @@ namespace Edu.Module.Exam
};
}
/// <summary>
/// 获取单词预习分页列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_StuWords_Prep_Extend> GetStuWordsPrepPageModule(int pageIndex, int pageSize, out long rowsCount, RB_StuWords_Prep_Extend query)
{
var list = stuWords_PrepRepository.GetStuWordsPrepPageRepository(pageIndex, pageSize, out rowsCount, query);
return list;
}
/// <summary>
/// 获取单词预习列表
......@@ -368,6 +358,8 @@ namespace Edu.Module.Exam
CourseId = model.CourseId,
QChapterIds = model.ChapterId+","+model.ReviewCourseChapterId
});
//当前章节单词总数
var currentChapterCount = wordsList?.Where(qitem => qitem.ChapterId == model.ChapterId)?.Count() ?? 0;
var oldModel = GetStuWordsPrepListModule(new RB_StuWords_Prep_Extend()
{
Stu_Account_Id = model.Stu_Account_Id,
......@@ -376,14 +368,24 @@ namespace Edu.Module.Exam
Group_Id = model.Group_Id
})?.FirstOrDefault();
model.Id = oldModel?.Id ?? 0;
model.TotalNum = oldModel?.TotalNum ?? (wordsList?.Count ?? 0);
if (model.Id > 0)
{
model.TotalNum = oldModel?.TotalNum ?? (wordsList?.Count ?? 0);
Dictionary<string, object> fileds = new Dictionary<string, object>()
Dictionary<string, object> fileds = new Dictionary<string, object>();
//预习
if (model.StudyType == 1)
{
{nameof(RB_StuWords_Prep_Extend.StudyNum),model.StudyNum },
};
model.Score = GetScoreModule(model.StudyNum, model.TotalNum);
fileds.Add(nameof(RB_StuWords_Prep_Extend.PrepNum), model.PrepNum);
model.StudyNum = model.PrepNum;
}
//复习
else
{
fileds.Add(nameof(RB_StuWords_Prep_Extend.ReviewNum), model.ReviewNum);
model.StudyNum =oldModel.PrepNum+ model.ReviewNum;
}
fileds.Add(nameof(RB_StuWords_Prep_Extend.StudyNum), model.StudyNum);
model.Score = GetScoreModule(model.PrepNum, currentChapterCount);
fileds.Add(nameof(RB_StuWords_Prep_Extend.Score), model.Score);
if (model.StudyNum == (wordsList?.Count ?? 0))
{
......@@ -394,9 +396,9 @@ namespace Edu.Module.Exam
}
else
{
model.PrepNum = 1;
model.StudyNum = 1;
model.TotalNum = wordsList?.Count() ?? 0;
model.Score = GetScoreModule(model.StudyNum, model.TotalNum);
model.Score = GetScoreModule(model.PrepNum, currentChapterCount);
model.StartTime = DateTime.Now;
var newId = stuWords_PrepRepository.Insert(model);
model.Id = newId;
......
......@@ -29,8 +29,8 @@ namespace Edu.WebApi.Controllers.Applet
{
var CourseId = base.ParmJObj.GetInt("CourseId");
var ChapterId = base.ParmJObj.GetInt("ChapterId");
var PrevChapterId = base.ParmJObj.GetInt("PrevChapterId");
var list = courseExamModule.GetStudyCourseWords(CourseId, ChapterId, PrevChapterId);
var ReviewChapterId = base.ParmJObj.GetInt("ReviewChapterId");
var list = courseExamModule.GetStudyCourseWords(CourseId, ChapterId, ReviewChapterId);
return ApiResult.Success(data: list);
}
......@@ -53,6 +53,7 @@ namespace Edu.WebApi.Controllers.Applet
ReviewNum=base.ParmJObj.GetInt("ReviewNum"),
StudyNum=base.ParmJObj.GetInt("StudyNum"),
ReviewCourseChapterId=base.ParmJObj.GetInt("ReviewCourseChapterId"),
StudyType=base.ParmJObj.GetInt("StudyType"),
};
model.CreateBy = base.AppletUserInfo.Id;
model.CreateTime = DateTime.Now;
......
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