bool MainWindow::checkPassedB(quint32 ga1, quint32 ga2, quint32 wiso,quint32 nr, quint32 points){ bool retVal=true; switch(nr){ case 0: if(calcB(ga1,ga2,wiso)<50 || ga1<30 || ga2<30 || wiso<30){ retVal = false; } break; case 1: if(calcB(ga1,ga2,wiso,nr,points)<50 || round((2.0*ga1+points)/3.0)<30 || ga2<30 || wiso<30){ retVal = false; } break; case 2: if(calcB(ga1,ga2,wiso,nr,points)<50 || round((2.0*ga2+points)/3.0)<30 || ga1<30 || wiso<30){ retVal = false; } break; case 3: if(calcB(ga1,ga2,wiso,nr,points)<50 || round((2.0*wiso+points)/3.0)<30 || ga2<30 || ga1<30){ retVal = false; } break; default: ; // error } return retVal; }
const Foam::scalarSquareMatrix& Foam::RBFInterpolation::B() const { if (!BPtr_) { calcB(); } return *BPtr_; }
bool MainWindow::checkMAllowed(quint32 ga1,quint32 ga2,quint32 wiso){ bool retVal=true; if(ga1<50 && ga2<50 && wiso<50){ // 3 5's retVal=false; } if(calcB(ga1,ga2,wiso)>=50){ // too good retVal=false; } if(ga1<30 || ga2<30 || wiso<30){ // at least one ungenügend retVal=false; } if( (round((round((ga1*2.0+100.0)/3.0)*2.0+ga2*2.0+wiso)/5.0)<50) && (round((round((ga2*2.0+100.0)/3.0)*2.0+ga1*2.0+wiso)/5.0)<50) && (round((round((wiso*2.0+100.0)/3.0)+ga1*2.0+ga2*2.0)/5.0)<50)){ // no possibility retVal=false; } return retVal; }
size_t calcA() { return sizeof(int) + calcB(); }
void MainWindow::writeResults(){ // Part A quint32 docu = (quint32) ui->spinboxDocumentation->value(); quint32 exam = (quint32) ui->spinboxExamination->value(); qint32 pointsA = calcA(docu,exam); QString gradeA = getGrade(pointsA); ui->labelPointsA->setText(QString::number(pointsA).rightJustified(3,' ')); if(checkPassedA(docu,exam)){ ui->labelGradeA->setStyleSheet("QLabel { color : green; }"); } else{ ui->labelGradeA->setStyleSheet("QLabel { color : red; }"); } ui->labelGradeA->setText(getGrade(pointsA).rightJustified(12,' ')); // Part B quint32 nr=0; quint32 points=0; quint32 ga1 = (quint32) ui->spinboxGa1->value(); quint32 ga2 = (quint32) ui->spinboxGa2->value(); quint32 wiso = (quint32) ui->spinboxWiso->value(); // quint32 ga1E = (quint32) ui->spinboxGa1E->value(); // quint32 ga2E = (quint32) ui->spinboxGa2E->value(); // quint32 wisoE = (quint32) ui->spinboxWisoE->value(); if(checkMAllowed(ga1,ga2,wiso)){ // oral is possible if(round((round((ga1*2.0+100.0)/3.0)*2.0+ga2*2.0+wiso)/5.0)>=50 && ga1<50){ // oral in ga1 ui->radioButton1->setEnabled(true); if(ui->radioButton1->isChecked()){ // oral in ga1 ui->spinboxGa1E->setEnabled(true); ui->spinboxGa1E->show(); nr=1; points=ui->spinboxGa1E->value(); } else{ ui->spinboxGa1E->setValue(0); ui->spinboxGa1E->setEnabled(false); ui->spinboxGa1E->hide(); } } else{ ui->radioButton1->setAutoExclusive(false); ui->radioButton2->setAutoExclusive(false); ui->radioButton3->setAutoExclusive(false); ui->radioButton1->setChecked(false); ui->radioButton1->setAutoExclusive(true); ui->radioButton2->setAutoExclusive(true); ui->radioButton3->setAutoExclusive(true); ui->radioButton1->setEnabled(false); ui->spinboxGa1E->setValue(0); ui->spinboxGa1E->hide(); } if(round((round((ga2*2.0+100.0)/3.0)*2.0+ga1*2.0+wiso)/5.0)>=50 && ga2<50){ // oral in ga2 ui->radioButton2->setEnabled(true); if(ui->radioButton2->isChecked()){ // oral in ga1 ui->spinboxGa2E->setEnabled(true); ui->spinboxGa2E->show(); nr=2; points=ui->spinboxGa2E->value(); } else{ ui->spinboxGa2E->setValue(0); ui->spinboxGa2E->setEnabled(false); ui->spinboxGa2E->hide(); } } else{ ui->radioButton1->setAutoExclusive(false); ui->radioButton2->setAutoExclusive(false); ui->radioButton3->setAutoExclusive(false); ui->radioButton2->setChecked(false); ui->radioButton1->setAutoExclusive(true); ui->radioButton2->setAutoExclusive(true); ui->radioButton3->setAutoExclusive(true); ui->radioButton2->setEnabled(false); ui->spinboxGa2E->setValue(0); ui->spinboxGa2E->hide(); } if(round((round((wiso*2.0+100.0)/3.0)+ga1*2.0+ga2*2.0)/5.0)>=50 && wiso<50){ // oral in wiso ui->radioButton3->setEnabled(true); if(ui->radioButton3->isChecked()){ // oral in ga1 ui->spinboxWisoE->setEnabled(true); ui->spinboxWisoE->show(); nr=3; points=ui->spinboxWisoE->value(); } else{ ui->spinboxWisoE->setValue(0); ui->spinboxWisoE->setEnabled(false); ui->spinboxWisoE->hide(); } } else{ ui->radioButton1->setAutoExclusive(false); ui->radioButton2->setAutoExclusive(false); ui->radioButton3->setAutoExclusive(false); ui->radioButton3->setChecked(false); ui->radioButton1->setAutoExclusive(true); ui->radioButton2->setAutoExclusive(true); ui->radioButton3->setAutoExclusive(true); ui->radioButton3->setChecked(false); ui->radioButton3->setEnabled(false); ui->spinboxWisoE->setValue(0); ui->spinboxWisoE->hide(); } } else{ // oral not possible ui->radioButton1->setAutoExclusive(false); ui->radioButton2->setAutoExclusive(false); ui->radioButton3->setAutoExclusive(false); ui->radioButton1->setChecked(false); ui->radioButton1->setEnabled(false); ui->radioButton2->setChecked(false); ui->radioButton2->setEnabled(false); ui->radioButton3->setChecked(false); ui->radioButton3->setEnabled(false); ui->radioButton1->setAutoExclusive(true); ui->radioButton2->setAutoExclusive(true); ui->radioButton3->setAutoExclusive(true); ui->spinboxGa1E->setValue(0); ui->spinboxGa1E->hide(); ui->spinboxGa2E->setValue(0); ui->spinboxGa2E->hide(); ui->spinboxWisoE->setValue(0); ui->spinboxWisoE->hide(); } if(checkPassedB(ga1,ga2,wiso,nr,points)){ ui->labelGradeB->setStyleSheet("QLabel { color : green; }"); } else{ ui->labelGradeB->setStyleSheet("QLabel { color : red; }"); } qint32 pointsB = calcB(ga1,ga2,wiso,nr,points); QString gradeB = getGrade(pointsB); ui->labelPointsB->setText(QString::number(pointsB).rightJustified(3,' ')); ui->labelGradeB->setText(getGrade(pointsB).rightJustified(12,' ')); // Results // Part A ui->labelResultA->setText(QString::number(pointsA).rightJustified(3,' ')); if(checkPassedA(docu,exam)){ ui->labelGradeResultA->setStyleSheet("QLabel { color : green; }"); } else{ ui->labelGradeResultA->setStyleSheet("QLabel { color : red; }"); } ui->labelGradeResultA->setText(getGrade(pointsA).rightJustified(12,' ')); // Part B ui->labelResultB->setText(QString::number(pointsB).rightJustified(3,' ')); if(checkPassedB(ga1,ga2,wiso,nr,points)){ ui->labelGradeResultB->setStyleSheet("QLabel { color : green; }"); } else{ ui->labelGradeResultB->setStyleSheet("QLabel { color : red; }"); } ui->labelGradeResultB->setText(getGrade(pointsB).rightJustified(12,' ')); // All quint32 pointsAll = calcAll(pointsA,pointsB); QString gradeAll = getGrade(pointsAll); ui->labelResultAll->setText(QString::number(pointsAll).rightJustified(3,' ')); if(checkPassedB(ga1,ga2,wiso,nr,points) && checkPassedA(docu,exam)){ ui->labelGradeResult->setStyleSheet("QLabel { color : green; }"); hasPassed=true; } else{ ui->labelGradeResult->setStyleSheet("QLabel { color : red; }"); hasPassed=false; } ui->labelGradeResult->setText(getGrade(pointsAll).rightJustified(12,' ')); fillPRFG(); fillMEPR(); ui->saveFile->setEnabled(true); }