Commit dfd8fd8b authored by luzhuang's avatar luzhuang

Merge remote-tracking branch 'origin/meiteng' into meiteng

parents c2cbddc6 c94d6b30
......@@ -308,8 +308,11 @@ public class BChapterServiceImpl implements BChapterService {
//上传文件数据插入到bfile表中
int x = bFileRepository.insertUploadFile(bFile);
bChapterRepository.updateClassHourInLesson(model.getLessonId());//更新b_lesson表中 class_hour
// 更新课程总进度
this.updateLessonProgress(chapterDTO.getLessonId(), true, 0);
// 新增节 才更新进度
if (2 == chapterDTO.getChapterLevel()){
// 更新课程总进度
this.updateLessonProgress(chapterDTO.getLessonId(), true, 0);
}
log.debug("-----------------------------更新课时成功-------------------");
}
} else {
......@@ -400,6 +403,9 @@ public class BChapterServiceImpl implements BChapterService {
// lessonPerson.setFinishDate(null);
lessonPerson.setFinishDateSetNull("1");
}
// 规避 复数 和超100% 的情况
newLearnProgress = newLearnProgress > 1 ? 1: newLearnProgress < 0 ? 0 : newLearnProgress;
lessonPerson.setLearnProgress(newLearnProgress * 100 + "%");
bLessonPersonRepository.updateAtChapter(lessonPerson);
studentChapter.setProgress(0);
......@@ -456,7 +462,6 @@ public class BChapterServiceImpl implements BChapterService {
}else {
int oldClassHour = Integer.parseInt(bLesson.getClassHour()) + 1;
newLearnProgress = numberFormat.format((learnProgress * oldClassHour - delProgress)/(oldClassHour -1) );
// newLearnProgress = numberFormat.format(learnProgress - delProgress/ (Integer.parseInt(bLesson.getClassHour()) + 1));
}
if (0 == Double.parseDouble(newLearnProgress)){
lessonPerson.setIsFinish("0");
......@@ -483,6 +488,9 @@ public class BChapterServiceImpl implements BChapterService {
bLessonServiceImpl.addValueEvent(lessonPerson.getPersonId(),bPersonValue,null);
lessonPerson.setEverFinished("1");
}
// 规避 复数 和超100% 的情况
float tempTotalProgress = Float.parseFloat(newLearnProgress);
newLearnProgress = String.valueOf(tempTotalProgress > 1 ? 1: tempTotalProgress < 0 ? 0 : tempTotalProgress);
lessonPerson.setLearnProgress(Float.parseFloat(newLearnProgress)*100+"%");
bLessonPersonRepository.updateAtChapter(lessonPerson);
......@@ -541,12 +549,16 @@ public class BChapterServiceImpl implements BChapterService {
bChapterRepository.updateSort(params);
}
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(id, userId);
double oldProgress = 0;
if (null !=brStudentChapterList && brStudentChapterList.size()>0){
oldProgress = brStudentChapterList.get(0).getProgress();
// 判断 2-节 才重新计算进度
if (2 == bChapter.getChapterLevel()){
double oldProgress = 0;
if (null !=brStudentChapterList && brStudentChapterList.size()>0){
oldProgress = brStudentChapterList.get(0).getProgress();
}
// 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false, oldProgress);
}
// 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false, oldProgress);
//删除student_chapter表中数据
bChapterRepository.deleteBStudentChapter(id,userId);
......
......@@ -123,6 +123,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
if (i == 0){
totalProgress = "0%";
}else {
// 规避 复数 和超100% 的情况
float tempTotalProgress = Float.parseFloat(numberFormat.format((float) percent / (float) i * 100));
totalProgress = tempTotalProgress > 100 ? "100%" : tempTotalProgress < 0 ? "0%" : tempTotalProgress + "%";
// totalProgress = tempTotalProgress + "%";
......
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