diff --git a/swad_changelog.h b/swad_changelog.h index b9958e1f3..327b65738 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo. */ -#define Log_PLATFORM_VERSION "SWAD 21.62.2 (2021-11-24)" +#define Log_PLATFORM_VERSION "SWAD 21.62.3 (2021-11-25)" #define CSS_FILE "swad21.59.css" #define JS_FILE "swad21.59.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 21.62.3: Nov 25, 2021 Fixed bug in test questions. Reported by Javier Fernández Baldomero and others. (319438 lines) Version 21.62.2: Nov 24, 2021 Fixed bug in forums. Reported by Javier Fernández Baldomero. (319422 lines) Version 21.62.1: Nov 24, 2021 Added some header files. (319422 lines) Version 21.62: Nov 24, 2021 Code refactoring in photos. (319415 lines) diff --git a/swad_question.c b/swad_question.c index 96406f0ca..6bfa546e3 100644 --- a/swad_question.c +++ b/swad_question.c @@ -1609,7 +1609,8 @@ void Qst_GetCorrectChoAnswerFromDB (struct Qst_Question *Question) unsigned NumOpt; /***** Query database *****/ - Question->Answer.NumOptions = Qst_DB_GetTextOfAnswers (&mysql_res,Question->QstCod); + // Question->Answer.NumOptions = Qst_DB_GetTextOfAnswers (&mysql_res,Question->QstCod); // TODO: Esta línea llevó al error del 25 de noviembre de 2021 Remove this line!!!!!!! + Question->Answer.NumOptions = Qst_DB_GetQstAnswersCorr (&mysql_res,Question->QstCod); /***** Get options *****/ for (NumOpt = 0; diff --git a/swad_question_database.c b/swad_question_database.c index 3728cc385..631caab5c 100644 --- a/swad_question_database.c +++ b/swad_question_database.c @@ -1351,6 +1351,21 @@ unsigned Qst_DB_GetTextOfAnswers (MYSQL_RES **mysql_res,long QstCod) return NumOptions; } +/*****************************************************************************/ +/********** Get answers correctness for a question in an exam set ************/ +/*****************************************************************************/ + +unsigned Qst_DB_GetQstAnswersCorr (MYSQL_RES **mysql_res,long QstCod) + { + return (unsigned) + DB_QuerySELECT (mysql_res,"can not get correctness of answers of a question", + "SELECT Correct" // row[0] + " FROM tst_answers" + " WHERE QstCod=%ld" + " ORDER BY AnsInd", + QstCod); + } + /*****************************************************************************/ /*********** Get suffled/not-shuffled answers indexes of question ************/ /*****************************************************************************/ diff --git a/swad_question_database.h b/swad_question_database.h index 08afb0a27..1fd3ddf86 100644 --- a/swad_question_database.h +++ b/swad_question_database.h @@ -67,6 +67,7 @@ unsigned Qst_DB_GetQstCodFromTypeAnsStem (MYSQL_RES **mysql_res, unsigned Qst_DB_GetNumAnswersQst (long QstCod); unsigned Qst_DB_GetDataOfAnswers (MYSQL_RES **mysql_res,long QstCod,bool Shuffle); unsigned Qst_DB_GetTextOfAnswers (MYSQL_RES **mysql_res,long QstCod); +unsigned Qst_DB_GetQstAnswersCorr (MYSQL_RES **mysql_res,long QstCod); unsigned Qst_DB_GetShuffledAnswersIndexes (MYSQL_RES **mysql_res, const struct Qst_Question *Question); unsigned Qst_DB_GetMedCodsFromStemsOfQstsInCrs (MYSQL_RES **mysql_res,long CrsCod); diff --git a/swad_test_print.c b/swad_test_print.c index be454953d..8d0c657b8 100644 --- a/swad_test_print.c +++ b/swad_test_print.c @@ -671,9 +671,9 @@ static void TstPrn_WriteQstAndAnsExam (struct UsrData *UsrDat, HTM_TxtColonNBSP (Txt_Score); HTM_SPAN_Begin ("class=\"%s\"", PrintedQuestions[QstInd].StrAnswers[0] ? - (PrintedQuestions[QstInd].Score > 0 ? "ANS_OK" : // Correct/semicorrect - "ANS_BAD") :// Wrong - "ANS_0"); // Blank answer + (PrintedQuestions[QstInd].Score > 0 ? "ANS_OK" : // Correct/semicorrect + "ANS_BAD") : // Wrong + "ANS_0"); // Blank answer HTM_Double2Decimals (PrintedQuestions[QstInd].Score); HTM_SPAN_End (); HTM_DIV_End (); diff --git a/swad_user.c b/swad_user.c index 1c77f254a..f73eca855 100644 --- a/swad_user.c +++ b/swad_user.c @@ -6387,7 +6387,7 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows) HTM_Txt (UsrDat->FrstName); } - if (NextAction[UsrDat->Roles.InCurrentCrs] == ActUnk) + if (!NextAction[UsrDat->Roles.InCurrentCrs]) /* End div */ HTM_DIV_End (); else