[virtualcommons-svn] commit/irrigation: alllee: fixing quiz results template and ui logic
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2012-03-06 09:05:45
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/1a1ec2be7895/ changeset: 1a1ec2be7895 user: alllee date: 2012-03-06 10:05:27 summary: fixing quiz results template and ui logic affected #: 3 files diff -r 700d1fb9a777ba42e02112205788113ce7a0604b -r 1a1ec2be7895e7f6db071889bb7731a5a4a28dd9 src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java --- a/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java @@ -10,6 +10,7 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Properties; @@ -270,19 +271,31 @@ public synchronized void actionPerformed(ActionEvent e) { FormActionEvent formEvent = (FormActionEvent) e; Properties actualAnswers = formEvent.getData(); + System.err.println("actual answers: " + actualAnswers); List<String> incorrectQuestionNumbers = new ArrayList<String>(); List<String> correctQuestionNumbers = new ArrayList<String>(); + List<String> missingQuestions = new ArrayList<String>(); for (Map.Entry<String, String> entry : quizAnswers.entrySet()) { String questionNumber = entry.getKey(); String number = questionNumber.substring(1); String correctAnswer = entry.getValue(); String actualAnswer = actualAnswers.getProperty(questionNumber); - if (actualAnswer == null) { - JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for question " + number + "."); - return; + if (actualAnswer == null || actualAnswer.trim().isEmpty()) { + missingQuestions.add(number); + continue; } ((correctAnswer.equals(actualAnswer)) ? correctQuestionNumbers : incorrectQuestionNumbers).add(questionNumber); } + int numberOfMissingQuestions = missingQuestions.size(); + if (numberOfMissingQuestions > 0) { + Collections.sort(missingQuestions); + JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for questions " + missingQuestions); + return; + } + else if (numberOfMissingQuestions == 1) { + JOptionPane.showMessageDialog(ExperimentGameWindow.this, "Please enter a quiz answer for question " + missingQuestions.get(0)); + return; + } setQuestionColors(correctQuestionNumbers, "blue"); setQuestionColors(incorrectQuestionNumbers, "red"); QuizResponseEvent event = new QuizResponseEvent(client.getId(), actualAnswers, incorrectQuestionNumbers); diff -r 700d1fb9a777ba42e02112205788113ce7a0604b -r 1a1ec2be7895e7f6db071889bb7731a5a4a28dd9 src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java --- a/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java +++ b/src/main/java/edu/asu/commons/irrigation/conf/ServerConfiguration.java @@ -157,11 +157,6 @@ String key = "q" + i; String answer = properties.getProperty(key); answers.put(key, answer); - String quizExplanationKey = "explanation" + i; - String quizExplanation = properties.getProperty(quizExplanationKey); - answers.put(quizExplanationKey, quizExplanation); - String descriptiveAnswerKey = "a" + i; - answers.put(descriptiveAnswerKey, properties.getProperty(descriptiveAnswerKey)); } return answers; } @@ -191,7 +186,7 @@ } public int getChatDuration() { - return getIntProperty("chat-duration", 60); + return getIntProperty("chat-duration", 5); } public String getGameScreenshotInstructions() { diff -r 700d1fb9a777ba42e02112205788113ce7a0604b -r 1a1ec2be7895e7f6db071889bb7731a5a4a28dd9 src/main/resources/configuration/asu/2011/pretest/irrigation.xml --- a/src/main/resources/configuration/asu/2011/pretest/irrigation.xml +++ b/src/main/resources/configuration/asu/2011/pretest/irrigation.xml @@ -195,7 +195,6 @@ The final two questions cover the number of tokens you can earn in within a round. <b>Please refer to table 2 of your handout</b>. </p> -<form> Question 5:<br> If you invest 7 of the 10 tokens you start with and you apply 202 cubic feet of water to your fields, what is the total number of tokens you will have earned at the @@ -210,7 +209,7 @@ <br><br><input type="submit" name="submit" value="Submit"><br> -<br> +</form> ]]></entry> @@ -562,9 +561,8 @@ water to your fields, what is the total number of tokens you will have earned at the end of the round?<br><b>{incorrect_q5} - If you invest 7 out of 10 tokens, you keep 3 tokens for yourself. If you apply 202 cubic feet of water to your field you - will earn 4 tokens. 3 + 4 = 7 tokens - <br><br> + If you invest 7 out of 10 tokens, you keep 3 tokens for yourself. If you apply 202 cubic feet of water to your field you will earn 4 tokens. 3 + 4 = 7 tokens</b> + <br><br><span class='q6'>Question 6:</span><br> If you invest all 10 tokens you start with and you apply 555 cubic feet of water to your fields, what is the total number of tokens you will have earned at the end of Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |