mirror of
https://gitlab.com/kauron/jstudy
synced 2024-12-23 00:43:32 +01:00
Test: remove item if the reponse was right or !repeatWrong
This commit is contained in:
parent
6aa43d2157
commit
b5d8b622dd
1 changed files with 15 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
||||||
package es.kauron.jstudy.controller;
|
package es.kauron.jstudy.controller;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.JFXTextField;
|
||||||
|
import es.kauron.jstudy.model.AppConfig;
|
||||||
import es.kauron.jstudy.model.TestItem;
|
import es.kauron.jstudy.model.TestItem;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -46,7 +47,16 @@ public class TestController implements Initializable {
|
||||||
correctAnswer.setVisible(!right);
|
correctAnswer.setVisible(!right);
|
||||||
correctLabel.setVisible(!right);
|
correctLabel.setVisible(!right);
|
||||||
|
|
||||||
list.remove(current);
|
// Remove the question from the pool if the question was correctly answered or there is no repetition
|
||||||
|
if (right || !AppConfig.repeatWrong) {
|
||||||
|
list.remove(current);
|
||||||
|
if (list.size() == 0) {
|
||||||
|
answer.setText("");
|
||||||
|
answer.setDisable(true);
|
||||||
|
question.setText("That's it!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
progress.setProgress(progress.getProgress() + 1.0/total);
|
progress.setProgress(progress.getProgress() + 1.0/total);
|
||||||
progressLabel.setText((int) (progress.getProgress() * total) + "/" + total);
|
progressLabel.setText((int) (progress.getProgress() * total) + "/" + total);
|
||||||
onSkipAction(event);
|
onSkipAction(event);
|
||||||
|
@ -54,15 +64,9 @@ public class TestController implements Initializable {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onSkipAction(ActionEvent event) {
|
private void onSkipAction(ActionEvent event) {
|
||||||
if (list.size() == 0) {
|
answer.setText("");
|
||||||
answer.setText("");
|
current = (int) (Math.random() * list.size());
|
||||||
answer.setDisable(true);
|
question.setText(list.get(current).getQuestion());
|
||||||
question.setText("That's it!");
|
answer.requestFocus();
|
||||||
} else {
|
|
||||||
answer.setText("");
|
|
||||||
current = (int) (Math.random() * list.size());
|
|
||||||
question.setText(list.get(current).getQuestion());
|
|
||||||
answer.requestFocus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue