From 637bc33d2db8a75d03a8bcc3da564feebdb7b190 Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Sun, 12 Jun 2016 15:32:51 +0200 Subject: [PATCH] Test: basis for counting errors and hits --- .../java/es/kauron/jstudy/controller/TestController.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/es/kauron/jstudy/controller/TestController.java b/src/main/java/es/kauron/jstudy/controller/TestController.java index 70c0f75..98f5122 100644 --- a/src/main/java/es/kauron/jstudy/controller/TestController.java +++ b/src/main/java/es/kauron/jstudy/controller/TestController.java @@ -26,6 +26,7 @@ public class TestController implements Initializable { private List list; private int total, current; + private int done = 0, errors = 0; @Override public void initialize(URL url, ResourceBundle resourceBundle) { @@ -50,11 +51,13 @@ public class TestController implements Initializable { correctAnswer.setVisible(!right); correctLabel.setVisible(!right); + if (!right) errors++; + // Remove the question from the pool if the question was correctly answered or there is no repetition if (right || !AppConfig.repeatWrong) { list.remove(current); - progress.setProgress(progress.getProgress() + 1.0/total); - progressLabel.setText((int) (progress.getProgress() * total) + "/" + total); + progress.setProgress(++done/(double)total); + progressLabel.setText(done + "/" + total); if (list.size() == 0) { answer.setText(""); answer.setDisable(true);