mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-25 07:07:21 -08:00
FlashExam: bugfixes
This commit is contained in:
parent
dcfaa5d1eb
commit
d5f23ac88a
1 changed files with 18 additions and 16 deletions
|
@ -93,6 +93,7 @@ void flashExam::initCardsList(QString cardsList, QString answersList) {
|
||||||
cardsAlreadyShown.clear();
|
cardsAlreadyShown.clear();
|
||||||
cardsNotKnown.clear();
|
cardsNotKnown.clear();
|
||||||
ui->nonRedundantRandomizationCheckBox->setChecked(false);
|
ui->nonRedundantRandomizationCheckBox->setChecked(false);
|
||||||
|
ui->brainBruteForceCheckBox->setChecked(false);
|
||||||
cardsTotal = cardsStringList.count() + 1;
|
cardsTotal = cardsStringList.count() + 1;
|
||||||
displayCard(false);
|
displayCard(false);
|
||||||
ui->stackedWidget->setCurrentIndex(1);
|
ui->stackedWidget->setCurrentIndex(1);
|
||||||
|
@ -136,24 +137,23 @@ void flashExam::on_nextBtn_clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
void flashExam::displayCard(bool existingCardNumber) {
|
void flashExam::displayCard(bool existingCardNumber) {
|
||||||
if(nonRedundantRandomization) {
|
|
||||||
float cardsTotalFloat = cardsTotal * 1.0;
|
|
||||||
float cardsAlreadyShownNumber = cardsAlreadyShown.count() * 1.0;
|
|
||||||
float cardsNotKnownNumber = cardsNotKnown.count() * 1.0;
|
|
||||||
ui->cardNumberLabel->setText(QString::number(cardsAlreadyShownNumber / cardsTotalFloat * 100, 'f', 1) + "% done, " + QString::number(cardsNotKnownNumber / cardsTotalFloat * 100, 'f', 1) + "% forgotten");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(!brainBruteForceLock) {
|
|
||||||
ui->cardNumberLabel->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!existingCardNumber) {
|
if(!existingCardNumber) {
|
||||||
if(randomize) {
|
if(randomize) {
|
||||||
if(brainBruteForceLock && cardsNotKnown.isEmpty()) {
|
if(brainBruteForceLock && cardsNotKnown.isEmpty()) {
|
||||||
brainBruteForceLock = false;
|
brainBruteForceLock = false;
|
||||||
ui->cardNumberLabel->hide();
|
}
|
||||||
ui->cardNumberLabel->setText("");
|
if(nonRedundantRandomization) {
|
||||||
|
float cardsTotalFloat = cardsTotal * 1.0;
|
||||||
|
float cardsAlreadyShownNumber = cardsAlreadyShown.count() * 1.0;
|
||||||
|
float cardsNotKnownNumber = cardsNotKnown.count() * 1.0;
|
||||||
|
if(!brainBruteForceLock) {
|
||||||
|
if(brainBruteForceMode) {
|
||||||
|
ui->cardNumberLabel->setText(QString::number(cardsAlreadyShownNumber / cardsTotalFloat * 100, 'f', 1) + "% done");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->cardNumberLabel->setText(QString::number(cardsAlreadyShownNumber / cardsTotalFloat * 100, 'f', 1) + "% done, " + QString::number(cardsNotKnownNumber / cardsTotalFloat * 100, 'f', 1) + "% forgotten");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(brainBruteForceMode && cardsNotKnown.count() >= brainBruteForceCardsThreshold) {
|
if(brainBruteForceMode && cardsNotKnown.count() >= brainBruteForceCardsThreshold) {
|
||||||
brainBruteForceLock = true;
|
brainBruteForceLock = true;
|
||||||
|
@ -170,8 +170,10 @@ void flashExam::displayCard(bool existingCardNumber) {
|
||||||
currentCardNumber = QRandomGenerator::global()->bounded(cardsTotal - 1);
|
currentCardNumber = QRandomGenerator::global()->bounded(cardsTotal - 1);
|
||||||
}
|
}
|
||||||
if(nonRedundantRandomization) {
|
if(nonRedundantRandomization) {
|
||||||
if(!cardsAlreadyShown.contains(currentCardNumber)) {
|
if(brainBruteForceLock || !cardsAlreadyShown.contains(currentCardNumber)) {
|
||||||
cardsAlreadyShown.append(currentCardNumber);
|
if(!brainBruteForceLock) {
|
||||||
|
cardsAlreadyShown.append(currentCardNumber);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue