|
@@ -37,7 +37,7 @@ public class SubjectQuestionLevelModule implements Module {
|
|
|
|
|
|
protected QuestionCalculatorProvider provider;
|
|
protected QuestionCalculatorProvider provider;
|
|
|
|
|
|
- protected Map<String, List<ExamQuestion>> questions;
|
|
|
|
|
|
+ protected Map<String, List<ExamQuestion>> objectiveQuestions, subjectiveQuestions;
|
|
|
|
|
|
protected Map<String, QuestionCounter> difficulityLevels, discriminationLevels;
|
|
protected Map<String, QuestionCounter> difficulityLevels, discriminationLevels;
|
|
|
|
|
|
@@ -46,7 +46,8 @@ public class SubjectQuestionLevelModule implements Module {
|
|
public SubjectQuestionLevelModule(ReportContext context, QuestionCalculatorProvider provider) {
|
|
public SubjectQuestionLevelModule(ReportContext context, QuestionCalculatorProvider provider) {
|
|
this.context = context;
|
|
this.context = context;
|
|
this.provider = provider;
|
|
this.provider = provider;
|
|
- this.questions = new HashMap<String, List<ExamQuestion>>();
|
|
|
|
|
|
+ this.objectiveQuestions = new HashMap<String, List<ExamQuestion>>();
|
|
|
|
+ this.subjectiveQuestions = new HashMap<String, List<ExamQuestion>>();
|
|
this.difficulityLevels = new HashMap<String, QuestionCounter>();
|
|
this.difficulityLevels = new HashMap<String, QuestionCounter>();
|
|
this.discriminationLevels = new HashMap<String, QuestionCounter>();
|
|
this.discriminationLevels = new HashMap<String, QuestionCounter>();
|
|
this.difficulityLevelConfig = context.getDifficulityLevelConfig();
|
|
this.difficulityLevelConfig = context.getDifficulityLevelConfig();
|
|
@@ -56,12 +57,17 @@ public class SubjectQuestionLevelModule implements Module {
|
|
@Override
|
|
@Override
|
|
public void process(ExamStudent student) {
|
|
public void process(ExamStudent student) {
|
|
String key = student.getSubjectCode() + "\t" + StringUtils.trimToEmpty(student.getPaperType());
|
|
String key = student.getSubjectCode() + "\t" + StringUtils.trimToEmpty(student.getPaperType());
|
|
- List<ExamQuestion> list = questions.get(key);
|
|
|
|
- if (list == null) {
|
|
|
|
- list = new ArrayList<ExamQuestion>();
|
|
|
|
- questions.put(key, list);
|
|
|
|
- list.addAll(student.getObjectiveQuestionList());
|
|
|
|
- list.addAll(student.getSubjectiveQuestionList());
|
|
|
|
|
|
+ List<ExamQuestion> olist = objectiveQuestions.get(key);
|
|
|
|
+ if (olist == null) {
|
|
|
|
+ olist = new ArrayList<ExamQuestion>();
|
|
|
|
+ objectiveQuestions.put(key, olist);
|
|
|
|
+ olist.addAll(student.getObjectiveQuestionList());
|
|
|
|
+ }
|
|
|
|
+ List<ExamQuestion> slist = subjectiveQuestions.get(student.getSubjectCode());
|
|
|
|
+ if (slist == null) {
|
|
|
|
+ slist = new ArrayList<ExamQuestion>();
|
|
|
|
+ subjectiveQuestions.put(key, slist);
|
|
|
|
+ slist.addAll(student.getSubjectiveQuestionList());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -138,9 +144,21 @@ public class SubjectQuestionLevelModule implements Module {
|
|
}
|
|
}
|
|
|
|
|
|
protected void beforeSave() {
|
|
protected void beforeSave() {
|
|
- for (Entry<String, List<ExamQuestion>> entry : questions.entrySet()) {
|
|
|
|
- Set<String> subjectiveSet = new HashSet<String>();
|
|
|
|
- String key = entry.getKey();
|
|
|
|
|
|
+ // paperType集合
|
|
|
|
+ Map<String, Set<String>> paperTypes = new HashMap<String, Set<String>>();
|
|
|
|
+ // 遍历客观题
|
|
|
|
+ for (Entry<String, List<ExamQuestion>> entry : objectiveQuestions.entrySet()) {
|
|
|
|
+ String[] keys = entry.getKey().split("\t");
|
|
|
|
+ String subjectCode = keys[0];
|
|
|
|
+ String paperType = StringUtils.trimToNull(keys[1]);
|
|
|
|
+ if (paperType != null) {
|
|
|
|
+ Set<String> set = paperTypes.get(subjectCode);
|
|
|
|
+ if (set == null) {
|
|
|
|
+ set = new HashSet<String>();
|
|
|
|
+ paperTypes.put(subjectCode, set);
|
|
|
|
+ }
|
|
|
|
+ set.add(paperType);
|
|
|
|
+ }
|
|
for (ExamQuestion question : entry.getValue()) {
|
|
for (ExamQuestion question : entry.getValue()) {
|
|
if (question.getTotalScore() == null || question.getTotalScore() == 0) {
|
|
if (question.getTotalScore() == null || question.getTotalScore() == 0) {
|
|
continue;
|
|
continue;
|
|
@@ -149,22 +167,44 @@ public class SubjectQuestionLevelModule implements Module {
|
|
if (calculator == null) {
|
|
if (calculator == null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- if (!question.isObjective()) {
|
|
|
|
- String number = question.getQuestionNumber();
|
|
|
|
- if (subjectiveSet.contains(number)) {
|
|
|
|
- continue;
|
|
|
|
- } else {
|
|
|
|
- subjectiveSet.add(number);
|
|
|
|
- }
|
|
|
|
|
|
+ // 按全卷维度统计
|
|
|
|
+ findDifficulityLevelCounter(entry.getKey()).process(question, calculator.difficulty);
|
|
|
|
+ findDiscriminationLevelCounter(entry.getKey()).process(question, calculator.discrimination);
|
|
|
|
+ // 按大题维度统计
|
|
|
|
+ findDifficulityLevelCounter(getGroupKey(question)).process(question, calculator.difficulty);
|
|
|
|
+ findDiscriminationLevelCounter(getGroupKey(question)).process(question, calculator.discrimination);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 遍历主观题
|
|
|
|
+ for (Entry<String, List<ExamQuestion>> entry : subjectiveQuestions.entrySet()) {
|
|
|
|
+ String subjectCode = entry.getKey();
|
|
|
|
+ for (ExamQuestion question : entry.getValue()) {
|
|
|
|
+ if (question.getTotalScore() == null || question.getTotalScore() == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ BaseCalculatorUnit calculator = provider.getCalculator(question);
|
|
|
|
+ if (calculator == null) {
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
// 按全卷维度统计
|
|
// 按全卷维度统计
|
|
- findDifficulityLevelCounter(key).process(question, calculator.difficulty);
|
|
|
|
- findDiscriminationLevelCounter(key).process(question, calculator.discrimination);
|
|
|
|
|
|
+ Set<String> paperTypeSet = paperTypes.get(subjectCode);
|
|
|
|
+ if (paperTypeSet == null || paperTypeSet.isEmpty()) {
|
|
|
|
+ // 不区分paperType
|
|
|
|
+ String key = subjectCode + "\t";
|
|
|
|
+ findDifficulityLevelCounter(key).process(question, calculator.difficulty);
|
|
|
|
+ findDiscriminationLevelCounter(key).process(question, calculator.discrimination);
|
|
|
|
+ } else {
|
|
|
|
+ // 遍历已存在的paperType
|
|
|
|
+ for (String paperType : paperTypeSet) {
|
|
|
|
+ String key = subjectCode + "\t" + paperType;
|
|
|
|
+ findDifficulityLevelCounter(key).process(question, calculator.difficulty);
|
|
|
|
+ findDiscriminationLevelCounter(key).process(question, calculator.discrimination);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 按大题维度统计
|
|
// 按大题维度统计
|
|
findDifficulityLevelCounter(getGroupKey(question)).process(question, calculator.difficulty);
|
|
findDifficulityLevelCounter(getGroupKey(question)).process(question, calculator.difficulty);
|
|
findDiscriminationLevelCounter(getGroupKey(question)).process(question, calculator.discrimination);
|
|
findDiscriminationLevelCounter(getGroupKey(question)).process(question, calculator.discrimination);
|
|
}
|
|
}
|
|
- subjectiveSet.clear();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|