Skip to content
Snippets Groups Projects
Commit f21f975e authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Merge branch 'freetext-learningprogress' into 'master'

Use preexisting questionValue instead of freeTextScore

There is no need for a separate property. `questionValue` is used by
learning progress views.

See merge request !26
parents a0654b33 593a2ac8
No related merge requests found
...@@ -1415,7 +1415,6 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware ...@@ -1415,7 +1415,6 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware
a.put("questionValue", answer.getQuestionValue()); a.put("questionValue", answer.getQuestionValue());
a.put("answerText", answer.getAnswerText()); a.put("answerText", answer.getAnswerText());
a.put("answerTextRaw", answer.getAnswerTextRaw()); a.put("answerTextRaw", answer.getAnswerTextRaw());
a.put("freeTextScore", answer.getFreeTextScore());
a.put("successfulFreeTextAnswer", answer.isSuccessfulFreeTextAnswer()); a.put("successfulFreeTextAnswer", answer.isSuccessfulFreeTextAnswer());
a.put("timestamp", answer.getTimestamp()); a.put("timestamp", answer.getTimestamp());
a.put("user", user.getUsername()); a.put("user", user.getUsername());
...@@ -1470,7 +1469,6 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware ...@@ -1470,7 +1469,6 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware
a.put("answerSubject", answer.getAnswerSubject()); a.put("answerSubject", answer.getAnswerSubject());
a.put("answerText", answer.getAnswerText()); a.put("answerText", answer.getAnswerText());
a.put("answerTextRaw", answer.getAnswerTextRaw()); a.put("answerTextRaw", answer.getAnswerTextRaw());
a.put("freeTextScore", answer.getFreeTextScore());
a.put("successfulFreeTextAnswer", answer.isSuccessfulFreeTextAnswer()); a.put("successfulFreeTextAnswer", answer.isSuccessfulFreeTextAnswer());
a.put("timestamp", answer.getTimestamp()); a.put("timestamp", answer.getTimestamp());
a.put("abstention", answer.isAbstention()); a.put("abstention", answer.isAbstention());
...@@ -2166,7 +2164,6 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware ...@@ -2166,7 +2164,6 @@ public class CouchDBDao implements IDatabaseDao, ApplicationEventPublisherAware
answerDoc.put("questionValue", a.getQuestionValue()); answerDoc.put("questionValue", a.getQuestionValue());
answerDoc.put("answerText", a.getAnswerText()); answerDoc.put("answerText", a.getAnswerText());
answerDoc.put("answerTextRaw", a.getAnswerTextRaw()); answerDoc.put("answerTextRaw", a.getAnswerTextRaw());
answerDoc.put("freeTextScore", a.getFreeTextScore());
answerDoc.put("timestamp", a.getTimestamp()); answerDoc.put("timestamp", a.getTimestamp());
answerDoc.put("piRound", a.getPiRound()); answerDoc.put("piRound", a.getPiRound());
answerDoc.put("abstention", a.isAbstention()); answerDoc.put("abstention", a.isAbstention());
......
...@@ -39,7 +39,6 @@ public class Answer implements Serializable { ...@@ -39,7 +39,6 @@ public class Answer implements Serializable {
private String answerText; private String answerText;
private String answerTextRaw; private String answerTextRaw;
private String answerSubject; private String answerSubject;
private double freeTextScore;
private boolean successfulFreeTextAnswer; private boolean successfulFreeTextAnswer;
private String questionVariant; private String questionVariant;
private int questionValue; private int questionValue;
...@@ -128,14 +127,6 @@ public class Answer implements Serializable { ...@@ -128,14 +127,6 @@ public class Answer implements Serializable {
this.answerSubject = answerSubject; this.answerSubject = answerSubject;
} }
public final double getFreeTextScore() {
return this.freeTextScore;
}
public final void setFreeTextScore(final double freeTextScore) {
this.freeTextScore = freeTextScore;
}
public final boolean isSuccessfulFreeTextAnswer() { public final boolean isSuccessfulFreeTextAnswer() {
return this.successfulFreeTextAnswer; return this.successfulFreeTextAnswer;
} }
......
...@@ -60,7 +60,7 @@ public class Question implements Serializable { ...@@ -60,7 +60,7 @@ public class Question implements Serializable {
private boolean ignorePunctuation; private boolean ignorePunctuation;
private boolean fixedAnswer; private boolean fixedAnswer;
private boolean strictMode; private boolean strictMode;
private double rating; private int rating;
private String correctAnswer; private String correctAnswer;
private String _id; private String _id;
private String _rev; private String _rev;
...@@ -357,11 +357,11 @@ public class Question implements Serializable { ...@@ -357,11 +357,11 @@ public class Question implements Serializable {
this.strictMode = strictMode; this.strictMode = strictMode;
} }
public final double getRating() { public final int getRating() {
return this.rating; return this.rating;
} }
public final void setRating(final double rating) { public final void setRating(final int rating) {
this.rating = rating; this.rating = rating;
} }
...@@ -690,7 +690,7 @@ public class Question implements Serializable { ...@@ -690,7 +690,7 @@ public class Question implements Serializable {
answer.setAnswerTextRaw(this.checkWhitespaces(answer.getAnswerTextRaw())); answer.setAnswerTextRaw(this.checkWhitespaces(answer.getAnswerTextRaw()));
} }
public double evaluateCorrectAnswerFixedText(String answerTextRaw) { public int evaluateCorrectAnswerFixedText(String answerTextRaw) {
if (answerTextRaw != null) { if (answerTextRaw != null) {
if (answerTextRaw.equals(this.getCorrectAnswer())) { if (answerTextRaw.equals(this.getCorrectAnswer())) {
return this.getRating(); return this.getRating();
......
...@@ -738,7 +738,7 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis ...@@ -738,7 +738,7 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis
question.checkTextStricktOptions(theAnswer); question.checkTextStricktOptions(theAnswer);
} }
if (question.isFixedAnswer()) { if (question.isFixedAnswer()) {
theAnswer.setFreeTextScore(question.evaluateCorrectAnswerFixedText(theAnswer.getAnswerTextRaw())); theAnswer.setQuestionValue(question.evaluateCorrectAnswerFixedText(theAnswer.getAnswerTextRaw()));
theAnswer.setSuccessfulFreeTextAnswer(question.isSuccessfulFreeTextAnswer(theAnswer.getAnswerTextRaw())); theAnswer.setSuccessfulFreeTextAnswer(question.isSuccessfulFreeTextAnswer(theAnswer.getAnswerTextRaw()));
} }
} }
......
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