diff --git a/src/main/java/es/kauron/jstudy/controller/Controller.java b/src/main/java/es/kauron/jstudy/controller/Controller.java index ea7eac9..0b117a3 100644 --- a/src/main/java/es/kauron/jstudy/controller/Controller.java +++ b/src/main/java/es/kauron/jstudy/controller/Controller.java @@ -66,7 +66,10 @@ public class Controller implements Initializable { } else { // update if in table tab tabIsTable.set(tabMap.get(n) != null); menuCloseTab.setDisable(!n.isClosable()); + menuSave.disableProperty().unbind(); menuSave.setDisable(!tabMap.containsKey(n) || tabMap.get(n).saved.get()); + if (tabMap.containsKey(n)) + menuSave.disableProperty().bind(tabMap.get(n).saved); } }); tabPane.getTabs().removeListener((ListChangeListener) c -> theTest = null); diff --git a/src/main/java/es/kauron/jstudy/controller/TestController.java b/src/main/java/es/kauron/jstudy/controller/TestController.java index 375cf85..d2fc4cc 100644 --- a/src/main/java/es/kauron/jstudy/controller/TestController.java +++ b/src/main/java/es/kauron/jstudy/controller/TestController.java @@ -44,7 +44,6 @@ public class TestController implements Initializable { void setList(List list) { this.list = list; int total = list.size(); - progress.setProgress(0); progressLabel.textProperty().bind(Bindings.format( String.format("%%.2f%%%% %%d / %d %%d mistakes", total), done.multiply(100.0).divide(total), done, errors)); @@ -75,18 +74,23 @@ public class TestController implements Initializable { } // Remove the question from the pool if the question was correctly answered or there is no repetition - if ((right && !correctingError.get()) || !AppPrefs.repeatWrong.get()) { + if (right || !AppPrefs.repeatWrong.get()) { + if (!correctingError.get()) + done.set(done.get() + 1); + correctingError.set(!right && AppPrefs.repeatImmediately.get()); list.remove(item.get()); - done.set(done.get() + 1); if (list.size() == 0) { onEndAction(null); return; } chooseQuestion(); - } else if (!AppPrefs.repeatImmediately.get()) { + } else if (AppPrefs.repeatImmediately.get()) { + correctingError.set(true); + item.set(new TestItem(item.get())); + list.add(item.get()); + } else { chooseQuestion(); } - correctingError.set(!right && AppPrefs.repeatImmediately.get()); answer.setText(""); answer.requestFocus(); }