From f668a24593af7c6dc912fd09dafa75cf6f9a0af7 Mon Sep 17 00:00:00 2001 From: acanas Date: Fri, 3 Apr 2020 19:19:41 +0200 Subject: [PATCH] Version19.160.1 --- swad_changelog.h | 3 +- swad_test_exam.c | 152 ++++------------------------------------------- 2 files changed, 15 insertions(+), 140 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 549ccc427..102850959 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.160 (2020-04-03)" +#define Log_PLATFORM_VERSION "SWAD 19.160.1 (2020-04-03)" #define CSS_FILE "swad19.146.css" #define JS_FILE "swad19.153.js" /* @@ -527,6 +527,7 @@ Param // TODO: Intentar cambiar Tst_WriteChoiceAnsSeeing usando Tst_GetQstDataFromDB y quitar Tst_GetChoiceAns // TODO: Intentar quitar Tst_GetOneQuestionByCod usando Tst_GetQstDataFromDB + Version 19.160.1: Apr 03, 2020 Score calculated is removed from each test question. (284817 lines) Version 19.160: Apr 03, 2020 The score for each test question displayed in an exam is the one stored in the database instead of being calculated. New file extension, suggested by Rosa Medina Doménech. (284933 lines) Copy the following icon to icon public directory: diff --git a/swad_test_exam.c b/swad_test_exam.c index 74acf945f..b68a7e8cf 100644 --- a/swad_test_exam.c +++ b/swad_test_exam.c @@ -142,8 +142,6 @@ static void TstExa_WriteTextAnsExam (struct UsrData *UsrDat, struct Tst_Question *Question, unsigned Visibility); static void TstExa_WriteHeadUserCorrect (struct UsrData *UsrDat); -static void TstExa_WriteScoreStart (unsigned ColSpan); -static void TstExa_WriteScoreEnd (void); static void TstExa_StoreOneExamQstInDB (const struct TstExa_Exam *Exam, unsigned NumQst); @@ -342,16 +340,19 @@ static void TstExa_WriteQstAndAnsExam (struct UsrData *UsrDat, Ale_ShowAlert (Ale_WARNING,Txt_Question_removed); /* Write score retrieved from database */ - HTM_DIV_Begin ("class=\"DAT_SMALL LM\""); - HTM_TxtColonNBSP (Txt_Score); - HTM_SPAN_Begin ("class=\"%s\"", - Exam->Questions[NumQst].StrAnswers[0] ? - (Exam->Questions[NumQst].Score > 0 ? "ANS_OK" : // Correct/semicorrect - "ANS_BAD") : // Wrong - "ANS_0"); // Blank answer - HTM_Double2Decimals (Exam->Questions[NumQst].Score); - HTM_SPAN_End (); - HTM_DIV_End (); + if (TstVis_IsVisibleEachQstScore (Visibility)) + { + HTM_DIV_Begin ("class=\"DAT_SMALL LM\""); + HTM_TxtColonNBSP (Txt_Score); + HTM_SPAN_Begin ("class=\"%s\"", + Exam->Questions[NumQst].StrAnswers[0] ? + (Exam->Questions[NumQst].Score > 0 ? "ANS_OK" : // Correct/semicorrect + "ANS_BAD") : // Wrong + "ANS_0"); // Blank answer + HTM_Double2Decimals (Exam->Questions[NumQst].Score); + HTM_SPAN_End (); + HTM_DIV_End (); + } /* Question feedback */ if (QuestionUneditedAfterExam) @@ -1002,29 +1003,6 @@ static void TstExa_WriteIntAnsExam (struct UsrData *UsrDat, HTM_TR_End (); - /***** Write the score of this question *****/ - if (TstVis_IsVisibleEachQstScore (Visibility)) - { - TstExa_WriteScoreStart (2); - if (!Exam->Questions[NumQst].StrAnswers[0]) // If user has omitted the answer - { - HTM_SPAN_Begin ("class=\"ANS_0\""); - HTM_Double2Decimals (0.0); - } - else if (IntAnswerUsr == Question->Answer.Integer) // If correct - { - HTM_SPAN_Begin ("class=\"ANS_OK\""); - HTM_Double2Decimals (1.0); - } - else // If wrong - { - HTM_SPAN_Begin ("class=\"ANS_BAD\""); - HTM_Double2Decimals (0.0); - } - HTM_SPAN_End (); - TstExa_WriteScoreEnd (); - } - HTM_TABLE_End (); } @@ -1086,30 +1064,6 @@ static void TstExa_WriteFloatAnsExam (struct UsrData *UsrDat, HTM_TR_End (); - /***** Write the score of this question *****/ - if (TstVis_IsVisibleEachQstScore (Visibility)) - { - TstExa_WriteScoreStart (2); - if (!Exam->Questions[NumQst].StrAnswers[0]) // If user has omitted the answer - { - HTM_SPAN_Begin ("class=\"ANS_0\""); - HTM_Double2Decimals (0.0); - } - else if (FloatAnsUsr >= Question->Answer.FloatingPoint[0] && - FloatAnsUsr <= Question->Answer.FloatingPoint[1]) // If correct (inside the interval) - { - HTM_SPAN_Begin ("class=\"ANS_OK\""); - HTM_Double2Decimals (1.0); - } - else // If wrong (outside the interval) - { - HTM_SPAN_Begin ("class=\"ANS_BAD\""); - HTM_Double2Decimals (0.0); - } - HTM_SPAN_End (); - TstExa_WriteScoreEnd (); - } - HTM_TABLE_End (); } @@ -1159,29 +1113,6 @@ static void TstExa_WriteTFAnsExam (struct UsrData *UsrDat, HTM_TR_End (); - /***** Write the score of this question *****/ - if (TstVis_IsVisibleEachQstScore (Visibility)) - { - TstExa_WriteScoreStart (2); - if (AnsTFUsr == '\0') // If user has omitted the answer - { - HTM_SPAN_Begin ("class=\"ANS_0\""); - HTM_Double2Decimals (0.0); - } - else if (AnsTFUsr == Question->Answer.TF) // If correct - { - HTM_SPAN_Begin ("class=\"ANS_OK\""); - HTM_Double2Decimals (1.0); - } - else // If wrong - { - HTM_SPAN_Begin ("class=\"ANS_BAD\""); - HTM_Double2Decimals (-1.0); - } - HTM_SPAN_End (); - TstExa_WriteScoreEnd (); - } - HTM_TABLE_End (); } @@ -1310,21 +1241,6 @@ static void TstExa_WriteChoiceAnsExam (struct UsrData *UsrDat, HTM_TR_End (); } - /***** Write the score of this question *****/ - if (TstVis_IsVisibleEachQstScore (Visibility)) - { - TstExa_WriteScoreStart (4); - if (Exam->Questions[NumQst].Score == 0.0) - HTM_SPAN_Begin ("class=\"ANS_0\""); - else if (Exam->Questions[NumQst].Score > 0.0) - HTM_SPAN_Begin ("class=\"ANS_OK\""); - else - HTM_SPAN_Begin ("class=\"ANS_BAD\""); - HTM_Double2Decimals (Exam->Questions[NumQst].Score); - HTM_SPAN_End (); - TstExa_WriteScoreEnd (); - } - /***** End table *****/ HTM_TABLE_End (); } @@ -1461,29 +1377,6 @@ static void TstExa_WriteTextAnsExam (struct UsrData *UsrDat, } HTM_TR_End (); - /***** Write the score of this question *****/ - if (TstVis_IsVisibleEachQstScore (Visibility)) - { - TstExa_WriteScoreStart (4); - if (!Exam->Questions[NumQst].StrAnswers[0]) // If user has omitted the answer - { - HTM_SPAN_Begin ("class=\"ANS_0\""); - HTM_Double2Decimals (0.0); - } - else if (Correct) // If correct - { - HTM_SPAN_Begin ("class=\"ANS_OK\""); - HTM_Double2Decimals (1.0); - } - else // If wrong - { - HTM_SPAN_Begin ("class=\"ANS_BAD\""); - HTM_Double2Decimals (0.0); - } - HTM_SPAN_End (); - TstExa_WriteScoreEnd (); - } - HTM_TABLE_End (); } @@ -1506,25 +1399,6 @@ static void TstExa_WriteHeadUserCorrect (struct UsrData *UsrDat) HTM_TD_End (); } -/*****************************************************************************/ -/*********** Write the start ans the end of the score of an answer ***********/ -/*****************************************************************************/ - -static void TstExa_WriteScoreStart (unsigned ColSpan) - { - extern const char *Txt_Score; - - HTM_TR_Begin (NULL); - HTM_TD_Begin ("colspan=\"%u\" class=\"DAT_SMALL LM\"",ColSpan); - HTM_TxtColonNBSP (Txt_Score); - } - -static void TstExa_WriteScoreEnd (void) - { - HTM_TD_End (); - HTM_TR_End (); - } - /*****************************************************************************/ /************* Store user's answers of an test exam into database ************/ /*****************************************************************************/