From 4ab83769be42b3c97e834b3ac02a156f46da7c7c Mon Sep 17 00:00:00 2001 From: acanas Date: Mon, 22 Jun 2020 19:27:23 +0200 Subject: [PATCH] Version19.253 --- css/{swad19.250.css => swad19.253.css} | 25 +- swad_HTML.c | 21 +- swad_HTML.h | 1 + swad_attendance.c | 6 +- swad_changelog.h | 5 +- swad_exam_print.c | 22 +- swad_exam_print.h | 15 +- swad_exam_result.c | 408 ++++++++++++++++++------- swad_figure.c | 70 ++--- swad_indicator.c | 6 +- swad_match_result.c | 50 +-- swad_test_print.c | 170 ++++++++--- swad_test_print.h | 12 +- swad_text.c | 167 ++++++++-- 14 files changed, 706 insertions(+), 272 deletions(-) rename css/{swad19.250.css => swad19.253.css} (99%) diff --git a/css/swad19.250.css b/css/swad19.253.css similarity index 99% rename from css/swad19.250.css rename to css/swad19.253.css index 95466644..850f677e 100644 --- a/css/swad19.250.css +++ b/css/swad19.253.css @@ -2400,11 +2400,24 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;} .DAT_N_BOLD {color:black; font-size:13pt; font-weight:bold;} /*********************** Line in top part of a table row *********************/ -.DAT_N_LINE_TOP +.LINE_TOP { - color:black; - font-size:13pt; - border-style:solid none none none; + border-top-style:solid; + border-width:1px; + } +.LINE_BOTTOM + { + border-bottom-style:solid; + border-width:1px; + } +.LINE_LEFT + { + border-left-style:solid; + border-width:1px; + } +.LINE_RIGHT + { + border-right-style:solid; border-width:1px; } @@ -4216,6 +4229,10 @@ a.PAG:hover, .PAG_CUR } /************ Something that takes up space but which is invisible ***********/ +.LIGHT + { + opacity:0.2; + } .HIDDEN { visibility:hidden; diff --git a/swad_HTML.c b/swad_HTML.c index 6dd8bed8..a32a3dfe 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -344,34 +344,34 @@ void HTM_TH_Begin (unsigned RowSpan,unsigned ColSpan,const char *Class) { if (Class) HTM_TH_BeginAttr ("rowspan=\"%u\" colspan=\"%u\" class=\"%s\"", - RowSpan,ColSpan,Class); + RowSpan,ColSpan,Class); else HTM_TH_BeginAttr ("rowspan=\"%u\" colspan=\"%u\"", - RowSpan,ColSpan); + RowSpan,ColSpan); } else if (RowSpan > 1) { if (Class) HTM_TH_BeginAttr ("rowspan=\"%u\" class=\"%s\"", - RowSpan,Class); + RowSpan,Class); else HTM_TH_BeginAttr ("rowspan=\"%u\"", - RowSpan); + RowSpan); } else if (ColSpan > 1) { if (Class) HTM_TH_BeginAttr ("colspan=\"%u\" class=\"%s\"", - ColSpan,Class); + ColSpan,Class); else HTM_TH_BeginAttr ("colspan=\"%u\"", - ColSpan); + ColSpan); } else { if (Class) HTM_TH_BeginAttr ("class=\"%s\"", - Class); + Class); else HTM_TH_BeginWithoutAttr (); } @@ -1827,6 +1827,13 @@ void HTM_Unsigned (unsigned Num) HTM_TxtF ("%u",Num); } +void HTM_Light0 (void) + { + HTM_SPAN_Begin ("class=\"LIGHT\""); + HTM_Txt ("0"); + HTM_SPAN_End (); + } + void HTM_Int (int Num) { HTM_TxtF ("%d",Num); diff --git a/swad_HTML.h b/swad_HTML.h index 5f1411c2..fb54c0ba 100644 --- a/swad_HTML.h +++ b/swad_HTML.h @@ -193,6 +193,7 @@ void HTM_Comma (void); void HTM_Hyphen (void); void HTM_Asterisk (void); void HTM_Unsigned (unsigned Num); +void HTM_Light0 (void); void HTM_Int (int Num); void HTM_UnsignedLong (unsigned long Num); void HTM_Long (long Num); diff --git a/swad_attendance.c b/swad_attendance.c index a923c1b0..f634a474 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -3356,7 +3356,7 @@ static void Att_ListUsrsAttendanceTable (const struct Att_Events *Events, { HTM_TR_Begin (NULL); - HTM_TD_Begin ("colspan=\"%u\" class=\"DAT_N_LINE_TOP RM\"", + HTM_TD_Begin ("colspan=\"%u\" class=\"DAT_N LINE_TOP RM\"", Gbl.Usrs.Listing.WithPhotos ? 4 : 3); HTM_TxtColon (Txt_Number_of_users); @@ -3367,14 +3367,14 @@ static void Att_ListUsrsAttendanceTable (const struct Att_Events *Events, NumAttEvent++) if (Events->Lst[NumAttEvent].Selected) { - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (Events->Lst[NumAttEvent].NumStdsFromList); HTM_TD_End (); Total += Events->Lst[NumAttEvent].NumStdsFromList; } - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (Total); HTM_TD_End (); diff --git a/swad_changelog.h b/swad_changelog.h index dccf6556..99d569f4 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -556,8 +556,8 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.252.1 (2020-06-19)" -#define CSS_FILE "swad19.250.css" +#define Log_PLATFORM_VERSION "SWAD 19.253 (2020-06-22)" +#define CSS_FILE "swad19.253.css" #define JS_FILE "swad19.246.1.js" /* TODO: Encarnación Hidalgo Tenorio: Antonio, ¿podría @swad_ugr mandar una notificación cuando el alumnado ha mandado su tarea? @@ -569,6 +569,7 @@ TODO: Que al generar un examen s TODO: Refactorizar MchRes_CheckIfICanSeeMatchResult y MchRes_CheckIfICanViewScore uniéndolas en una función como ExaRes_CheckIfICanSeePrintResult Y dentro de las funciones TstPrn_ShowUsrPrints y TstPrn_ShowOnePrint crear y llamar a una función común similar a ExaRes_CheckIfICanSeePrintResult + Version 19.253: Jun 22, 2020 More details in listing of exams. (303643 lines) Version 19.252.1: Jun 19, 2020 Changes in listing of exams and matches results. (303245 lines) Version 19.252: Jun 19, 2020 Fixed bug in exam results, reported by Francisco Ligero Ligero. (303243 lines) Version 19.251: Jun 18, 2020 Changes in test, exam and match results. (303263 lines) diff --git a/swad_exam_print.c b/swad_exam_print.c index 286e263f..30d1a552 100644 --- a/swad_exam_print.c +++ b/swad_exam_print.c @@ -162,12 +162,17 @@ static void ExaPrn_ResetPrintExceptEvtCodAndUsrCod (struct ExaPrn_Print *Print) Print->PrnCod = -1L; Print->TimeUTC[Dat_START_TIME] = Print->TimeUTC[Dat_END_TIME ] = (time_t) 0; - Print->NumQsts.All = - Print->NumQsts.Valid = - Print->NumQsts.NotBlank = 0; Print->Sent = false; // After creating an exam print, it's not sent - Print->Score.All = - Print->Score.Valid = 0.0; + Print->NumQsts.All = + Print->NumQsts.NotBlank = + Print->NumQsts.Valid.Correct = + Print->NumQsts.Valid.Wrong.Negative = + Print->NumQsts.Valid.Wrong.Zero = + Print->NumQsts.Valid.Wrong.Positive = + Print->NumQsts.Valid.Blank = + Print->NumQsts.Valid.Total = 0; + Print->Score.All = + Print->Score.Valid = 0.0; } /*****************************************************************************/ @@ -1426,9 +1431,10 @@ static void ExaPrn_GetNumQstsNotBlank (struct ExaPrn_Print *Print) /***** Count number of questions not blank in exam print in database *****/ Print->NumQsts.NotBlank = (unsigned) DB_QueryCOUNT ("can not get number of questions not blank", - "SELECT COUNT(*) FROM exa_print_questions" - " WHERE PrnCod=%ld AND Answers<>''", - Print->PrnCod); + "SELECT COUNT(*)" + " FROM exa_print_questions" + " WHERE PrnCod=%ld AND Answers<>''", + Print->PrnCod); } /*****************************************************************************/ diff --git a/swad_exam_print.h b/swad_exam_print.h index 7ff0a27d..f2e3721d 100644 --- a/swad_exam_print.h +++ b/swad_exam_print.h @@ -38,8 +38,19 @@ struct ExaPrn_NumQuestions { unsigned All; // Total number of questions - unsigned Valid; // Number of valid questions (not invalidated by teachers) - unsigned NotBlank; // Number of answered questions (not blank) + unsigned NotBlank; // Answered questions (valid or not) + struct + { + struct + { + unsigned Negative; + unsigned Zero; + unsigned Positive; + } Wrong; + unsigned Correct; + unsigned Blank; + unsigned Total; + } Valid; // Number of valid questions }; struct ExaPrn_Score diff --git a/swad_exam_result.c b/swad_exam_result.c index a61cc98a..0093e600 100644 --- a/swad_exam_result.c +++ b/swad_exam_result.c @@ -112,7 +112,6 @@ static void ExaRes_ShowResultsSummaryRow (unsigned NumResults, const struct ExaPrn_NumQuestions *NumTotalQsts, const struct ExaPrn_Score *TotalScore, double TotalGrade); -static void ExaRes_ShowNumQsts (const struct ExaPrn_NumQuestions *NumQsts); static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, const struct ExaSes_Session *Session, @@ -583,7 +582,7 @@ static void ExaRes_ShowResultsBegin (struct Exa_Exams *Exams, /***** Begin session results table *****/ HTM_SECTION_Begin (ExaRes_RESULTS_TABLE_ID); - HTM_TABLE_BeginWidePadding (2); + HTM_TABLE_BeginWidePadding (5); } static void ExaRes_ShowResultsEnd (void) @@ -703,24 +702,57 @@ static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther) extern const char *Txt_Session; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; extern const char *Txt_Questions; - extern const char *Txt_Non_blank_BR_questions; + extern const char *Txt_Valid_answers; extern const char *Txt_Score; - extern const char *Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1; extern const char *Txt_Grade; + extern const char *Txt_total; + extern const char *Txt_QUESTIONS_valid; + extern const char *Txt_QUESTIONS_invalid; + extern const char *Txt_correct_ANSWERS; + extern const char *Txt_wrong_ANSWERS; + extern const char *Txt_blank_ANSWERS; + extern const char *Txt_average; + /***** First row *****/ HTM_TR_Begin (NULL); - HTM_TH (1,2,"CT",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex : + HTM_TH (3,2,"CT",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex : Usr_SEX_UNKNOWN]); - HTM_TH (1,1,"LT",Txt_START_END_TIME[Dat_START_TIME]); - HTM_TH (1,1,"LT",Txt_START_END_TIME[Dat_END_TIME ]); - HTM_TH (1,1,"LT",Txt_Session); - HTM_TH (1,1,"RT",Txt_Questions); - HTM_TH (1,1,"RT",Txt_Non_blank_BR_questions); - HTM_TH (1,1,"RT",Txt_Score); - HTM_TH (1,1,"RT",Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1); - HTM_TH (1,1,"RT",Txt_Grade); - HTM_TH_Empty (1); + HTM_TH (3,1,"LT",Txt_START_END_TIME[Dat_START_TIME]); + HTM_TH (3,1,"LT",Txt_START_END_TIME[Dat_END_TIME ]); + HTM_TH (3,1,"LT",Txt_Session); + HTM_TH (1,3,"CT LINE_LEFT",Txt_Questions); + HTM_TH (1,5,"CT LINE_LEFT",Txt_Valid_answers); + HTM_TH (1,2,"CT LINE_LEFT",Txt_Score); + HTM_TH (3,1,"RT LINE_LEFT",Txt_Grade); + HTM_TH (3,1,"LINE_LEFT",NULL); + + HTM_TR_End (); + + /***** Second row *****/ + HTM_TR_Begin (NULL); + + HTM_TH (2,1,"RT LINE_LEFT",Txt_total); + HTM_TH (2,1,"RT",Txt_QUESTIONS_valid); + HTM_TH (2,1,"RT",Txt_QUESTIONS_invalid); + HTM_TH (1,1,"RT LINE_LEFT",Txt_correct_ANSWERS); + HTM_TH (1,3,"CT",Txt_wrong_ANSWERS); + HTM_TH (1,1,"RT",Txt_blank_ANSWERS); + HTM_TH (1,1,"RT LINE_LEFT",Txt_total); + HTM_TH (1,1,"RT",Txt_average); + + HTM_TR_End (); + + /***** Third row *****/ + HTM_TR_Begin (NULL); + + HTM_TH (1,1,"RT LINE_LEFT","pi=1"); + HTM_TH (1,1,"RT","-1≤pi<0"); + HTM_TH (1,1,"RT","pi=0"); + HTM_TH (1,1,"RT","0<pi<1"); + HTM_TH (1,1,"RT","pi=0"); + HTM_TH (1,1,"RT LINE_LEFT","Σpi"); + HTM_TH (1,1,"RT","-1≤p≤1"); HTM_TR_End (); } @@ -783,6 +815,7 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams, struct ExaSes_Session Session; struct Exa_Exam Exam; Dat_StartEndTime_t StartEndTime; + unsigned NumQstsInvalid; struct ExaPrn_NumQuestions NumTotalQsts; struct ExaPrn_Score TotalScore; double Grade; @@ -795,11 +828,16 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams, Exa_ResetExam (&Exam); /***** Reset total number of questions and total score *****/ - NumTotalQsts.All = - NumTotalQsts.Valid = - NumTotalQsts.NotBlank = 0; - TotalScore.All = - TotalScore.Valid = 0.0; + NumTotalQsts.All = + NumTotalQsts.NotBlank = + NumTotalQsts.Valid.Correct = + NumTotalQsts.Valid.Wrong.Negative = + NumTotalQsts.Valid.Wrong.Zero = + NumTotalQsts.Valid.Wrong.Positive = + NumTotalQsts.Valid.Blank = + NumTotalQsts.Valid.Total = 0; + TotalScore.All = + TotalScore.Valid = 0.0; /***** Set user *****/ UsrDat = (MeOrOther == Usr_ME) ? &Gbl.Usrs.Me.UsrDat : @@ -883,8 +921,7 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams, "SELECT exa_prints.PrnCod," // row[0] "exa_prints.SesCod," // row[1] "UNIX_TIMESTAMP(exa_prints.StartTime)," // row[2] - "UNIX_TIMESTAMP(exa_prints.EndTime)," // row[3] - "exa_prints.NumQstsNotBlank" // row[4] + "UNIX_TIMESTAMP(exa_prints.EndTime)" // row[3] " FROM exa_prints,exa_sessions,exa_exams" " WHERE exa_prints.UsrCod=%ld" "%s" // Session subquery @@ -969,38 +1006,120 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams, /* Compute score taking into account only valid questions */ ExaRes_ComputeValidPrintScore (&Print); - NumTotalQsts.Valid += Print.NumQsts.Valid; + NumTotalQsts.Valid.Correct += Print.NumQsts.Valid.Correct; + NumTotalQsts.Valid.Wrong.Negative += Print.NumQsts.Valid.Wrong.Negative; + NumTotalQsts.Valid.Wrong.Zero += Print.NumQsts.Valid.Wrong.Zero; + NumTotalQsts.Valid.Wrong.Positive += Print.NumQsts.Valid.Wrong.Positive; + NumTotalQsts.Valid.Blank += Print.NumQsts.Valid.Blank; + NumTotalQsts.Valid.Total += Print.NumQsts.Valid.Total; TotalScore.Valid += Print.Score.Valid; - - /* Get number of questions not blank (row[4]) */ - if (sscanf (row[4],"%u",&Print.NumQsts.NotBlank) != 1) - Print.NumQsts.NotBlank = 0; - NumTotalQsts.NotBlank += Print.NumQsts.NotBlank; } - /* Write number of questions */ - HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); + /* Write total number of questions */ + HTM_TD_Begin ("class=\"DAT LINE_LEFT RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanView.Score) - ExaRes_ShowNumQsts (&Print.NumQsts); + HTM_Unsigned (Print.NumQsts.All); else Ico_PutIconNotVisible (); HTM_TD_End (); - /* Write number of questions not blank */ + /* Valid questions */ + HTM_TD_Begin ("class=\"DAT_GREEN RT COLOR%u\"",Gbl.RowEvenOdd); + if (ICanView.Score) + { + if (Print.NumQsts.Valid.Total) + HTM_Unsigned (Print.NumQsts.Valid.Total); + else + HTM_Light0 (); + } + else + Ico_PutIconNotVisible (); + HTM_TD_End (); + + /* Invalid questions */ + HTM_TD_Begin ("class=\"DAT_RED RT COLOR%u\"",Gbl.RowEvenOdd); + if (ICanView.Score) + { + NumQstsInvalid = Print.NumQsts.All - Print.NumQsts.Valid.Total; + if (NumQstsInvalid) + HTM_Unsigned (NumQstsInvalid); + else + HTM_Light0 (); + } + else + Ico_PutIconNotVisible (); + HTM_TD_End (); + + /* Write number of correct questions */ + HTM_TD_Begin ("class=\"DAT LINE_LEFT RT COLOR%u\"",Gbl.RowEvenOdd); + if (ICanView.Score) + { + if (Print.NumQsts.Valid.Correct) + HTM_Unsigned (Print.NumQsts.Valid.Correct); + else + HTM_Light0 (); + } + else + Ico_PutIconNotVisible (); + HTM_TD_End (); + + /* Write number of wrong questions */ HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanView.Score) - HTM_Unsigned (Print.NumQsts.NotBlank); + { + if (Print.NumQsts.Valid.Wrong.Negative) + HTM_Unsigned (Print.NumQsts.Valid.Wrong.Negative); + else + HTM_Light0 (); + } + else + Ico_PutIconNotVisible (); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); + if (ICanView.Score) + { + if (Print.NumQsts.Valid.Wrong.Zero) + HTM_Unsigned (Print.NumQsts.Valid.Wrong.Zero); + else + HTM_Light0 (); + } + else + Ico_PutIconNotVisible (); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); + if (ICanView.Score) + { + if (Print.NumQsts.Valid.Wrong.Positive) + HTM_Unsigned (Print.NumQsts.Valid.Wrong.Positive); + else + HTM_Light0 (); + } + else + Ico_PutIconNotVisible (); + HTM_TD_End (); + + /* Write number of blank questions */ + HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); + if (ICanView.Score) + { + if (Print.NumQsts.Valid.Blank) + HTM_Unsigned (Print.NumQsts.Valid.Blank); + else + HTM_Light0 (); + } else Ico_PutIconNotVisible (); HTM_TD_End (); /* Write score valid (taking into account only valid questions) */ - HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT LINE_LEFT RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanView.Score) { HTM_Double2Decimals (Print.Score.Valid); HTM_Txt ("/"); - HTM_Unsigned (Print.NumQsts.Valid); + HTM_Unsigned (Print.NumQsts.Valid.Total); } else Ico_PutIconNotVisible (); @@ -1009,18 +1128,18 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams, /* Write average score per question (taking into account only valid questions) */ HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanView.Score) - HTM_Double2Decimals (Print.NumQsts.Valid ? Print.Score.Valid / - (double) Print.NumQsts.Valid : - 0.0); + HTM_Double2Decimals (Print.NumQsts.Valid.Total ? Print.Score.Valid / + (double) Print.NumQsts.Valid.Total : + 0.0); else Ico_PutIconNotVisible (); HTM_TD_End (); /* Write grade over maximum grade (taking into account only valid questions) */ - HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT LINE_LEFT RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanView.Score) { - Grade = TstPrn_ComputeGrade (Print.NumQsts.Valid,Print.Score.Valid,Exam.MaxGrade); + Grade = TstPrn_ComputeGrade (Print.NumQsts.Valid.Total,Print.Score.Valid,Exam.MaxGrade); TstPrn_ShowGrade (Grade,Exam.MaxGrade); TotalGrade += Grade; } @@ -1029,7 +1148,7 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams, HTM_TD_End (); /* Link to show this result */ - HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"LINE_LEFT RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanView.Result) { Exams->ExaCod = Session.ExaCod; @@ -1081,49 +1200,99 @@ static void ExaRes_ShowResultsSummaryRow (unsigned NumResults, double TotalGrade) { extern const char *Txt_Sessions; + unsigned NumTotalQstsInvalid; /***** Start row *****/ HTM_TR_Begin (NULL); /***** Row title *****/ - HTM_TD_Begin ("colspan=\"3\" class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("colspan=\"3\" class=\"DAT_N LINE_TOP LINE_BOTTOM RM COLOR%u\"",Gbl.RowEvenOdd); HTM_TxtColonNBSP (Txt_Sessions); HTM_Unsigned (NumResults); HTM_TD_End (); /***** Write total number of questions *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); - if (NumResults) - ExaRes_ShowNumQsts (NumTotalQsts); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_Unsigned (NumTotalQsts->All); HTM_TD_End (); - /***** Write total number of questions not blank *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); - if (NumResults) - HTM_Unsigned (NumTotalQsts->NotBlank); + /***** Write total number of valid questions *****/ + HTM_TD_Begin ("class=\"DAT_GREEN LINE_TOP LINE_BOTTOM RT COLOR%u\"",Gbl.RowEvenOdd); + if (NumTotalQsts->Valid.Total) + HTM_Unsigned (NumTotalQsts->Valid.Total); + else + HTM_Light0 (); + HTM_TD_End (); + + /***** Write total number of invalid questions *****/ + HTM_TD_Begin ("class=\"DAT_RED LINE_TOP LINE_BOTTOM RT COLOR%u\"",Gbl.RowEvenOdd); + NumTotalQstsInvalid = NumTotalQsts->All - NumTotalQsts->Valid.Total; + if (NumTotalQstsInvalid) + HTM_Unsigned (NumTotalQstsInvalid); + else + HTM_Light0 (); + HTM_TD_End (); + + /***** Write number of correct questions *****/ + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RT COLOR%u\"",Gbl.RowEvenOdd); + if (NumTotalQsts->Valid.Correct) + HTM_Unsigned (NumTotalQsts->Valid.Correct); + else + HTM_Light0 (); + HTM_TD_End (); + + /***** Write number of wrong questions *****/ + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RT COLOR%u\"",Gbl.RowEvenOdd); + if (NumTotalQsts->Valid.Wrong.Negative) + HTM_Unsigned (NumTotalQsts->Valid.Wrong.Negative); + else + HTM_Light0 (); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RT COLOR%u\"",Gbl.RowEvenOdd); + if (NumTotalQsts->Valid.Wrong.Zero) + HTM_Unsigned (NumTotalQsts->Valid.Wrong.Zero); + else + HTM_Light0 (); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RT COLOR%u\"",Gbl.RowEvenOdd); + if (NumTotalQsts->Valid.Wrong.Positive) + HTM_Unsigned (NumTotalQsts->Valid.Wrong.Positive); + else + HTM_Light0 (); + HTM_TD_End (); + + /***** Write number of blank questions *****/ + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RT COLOR%u\"",Gbl.RowEvenOdd); + if (NumTotalQsts->Valid.Blank) + HTM_Unsigned (NumTotalQsts->Valid.Blank); + else + HTM_Light0 (); HTM_TD_End (); /***** Write total valid score *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd); HTM_Double2Decimals (TotalScore->Valid); HTM_Txt ("/"); - HTM_Unsigned (NumTotalQsts->Valid); + HTM_Unsigned (NumTotalQsts->Valid.Total); HTM_TD_End (); /***** Write average valid score per valid question *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); - HTM_Double2Decimals (NumTotalQsts->Valid ? TotalScore->Valid / - (double) NumTotalQsts->Valid : - 0.0); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_Double2Decimals (NumTotalQsts->Valid.Total ? TotalScore->Valid / + (double) NumTotalQsts->Valid.Total : + 0.0); HTM_TD_End (); + /***** Write total grade *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd); HTM_Double2Decimals (TotalGrade); HTM_TD_End (); /***** Last cell *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_End (); /***** End row *****/ @@ -1134,39 +1303,6 @@ static void ExaRes_ShowResultsSummaryRow (unsigned NumResults, /*************************** Show one exam result ****************************/ /*****************************************************************************/ -static void ExaRes_ShowNumQsts (const struct ExaPrn_NumQuestions *NumQsts) - { - extern const char *Txt_QUESTIONS_valid; - extern const char *Txt_QUESTIONS_invalid; - - HTM_Unsigned (NumQsts->All); - - if (NumQsts->All != - NumQsts->Valid) - { - HTM_NBSP (); - HTM_Txt ("("); - - /* Valid questions */ - HTM_SPAN_Begin ("class=\"DAT_GREEN\" title=\"%s\"",Txt_QUESTIONS_valid); - HTM_Unsigned (NumQsts->Valid); - HTM_SPAN_End (); - - HTM_Txt ("+"); - - /* Invalid questions */ - HTM_SPAN_Begin ("class=\"DAT_RED\" title=\"%s\"",Txt_QUESTIONS_invalid); - HTM_Unsigned (NumQsts->All - NumQsts->Valid); - HTM_SPAN_End (); - - HTM_Txt (")"); - } - } - -/*****************************************************************************/ -/*************************** Show one exam result ****************************/ -/*****************************************************************************/ - void ExaRes_ShowOneExaResult (void) { struct Exa_Exams Exams; @@ -1206,6 +1342,7 @@ void ExaRes_ShowOneExaResult (void) Print.UsrCod = UsrDat->UsrCod; ExaPrn_GetDataOfPrintByCodAndUsrCod (&Print); + /***** Set log action and print code *****/ if (Gbl.Action.Act == ActEndExaPrn) { @@ -1241,7 +1378,10 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, extern const char *Txt_Questions; extern const char *Txt_QUESTIONS_valid; extern const char *Txt_QUESTIONS_invalid; - extern const char *Txt_QUESTIONS_non_blank; + extern const char *Txt_Valid_answers; + extern const char *Txt_correct_ANSWERS; + extern const char *Txt_wrong_ANSWERS; + extern const char *Txt_blank_ANSWERS; extern const char *Txt_Score; extern const char *Txt_valid_score; extern const char *Txt_Grade; @@ -1268,6 +1408,7 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, Gbl.Hierarchy.Deg.DegCod, Gbl.Hierarchy.Crs.CrsCod); + /***** Begin table *****/ HTM_TABLE_BeginWideMarginPadding (10); @@ -1285,7 +1426,7 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, HTM_TxtColon (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs.Role][UsrDat->Sex]); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); ID_WriteUsrIDs (UsrDat,NULL); HTM_TxtF (" %s",UsrDat->Surname1); if (UsrDat->Surname2[0]) @@ -1314,7 +1455,7 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, if (asprintf (&Id,"match_%u",(unsigned) StartEndTime) < 0) Lay_NotEnoughMemoryExit (); - HTM_TD_Begin ("id=\"%s\" class=\"DAT LT\"",Id); + HTM_TD_Begin ("id=\"%s\" class=\"DAT LB\"",Id); Dat_WriteLocalDateHMSFromUTC (Id,Print->TimeUTC[StartEndTime], Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA, true,true,true,0x7); @@ -1331,31 +1472,30 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, HTM_TxtColon (Txt_Questions); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (ICanView.Result) { HTM_TxtF ("%u",Print->NumQsts.All); - if (Print->NumQsts.All != Print->NumQsts.Valid) + if (Print->NumQsts.All != Print->NumQsts.Valid.Total) { HTM_Txt (" ("); /* Valid questions */ HTM_SPAN_Begin ("class=\"DAT_GREEN\""); HTM_TxtColonNBSP (Txt_QUESTIONS_valid); - HTM_Unsigned (Print->NumQsts.Valid); + HTM_Unsigned (Print->NumQsts.Valid.Total); HTM_SPAN_End (); - HTM_TxtF (", "); + HTM_TxtF ("; "); /* Invalid questions */ HTM_SPAN_Begin ("class=\"DAT_RED\""); HTM_TxtColonNBSP (Txt_QUESTIONS_invalid); - HTM_Unsigned (Print->NumQsts.All - Print->NumQsts.Valid); + HTM_Unsigned (Print->NumQsts.All - Print->NumQsts.Valid.Total); HTM_SPAN_End (); HTM_Txt (")"); } - HTM_TxtF ("; %s: %u",Txt_QUESTIONS_non_blank,Print->NumQsts.NotBlank); } else Ico_PutIconNotVisible (); @@ -1363,6 +1503,31 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, HTM_TR_End (); + /***** Number of answers *****/ + HTM_TR_Begin (NULL); + + HTM_TD_Begin ("class=\"DAT_N RT\""); + HTM_TxtColon (Txt_Valid_answers); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT LB\""); + if (ICanView.Result) + HTM_TxtF ("%s(pi=1): %u; " + "%s(-1≤pi<0): %u; " + "%s(pi=0): %u; " + "%s(0<pi<1): %u; " + "%s(pi=0): %u", + Txt_correct_ANSWERS,Print->NumQsts.Valid.Correct, + Txt_wrong_ANSWERS ,Print->NumQsts.Valid.Wrong.Negative, + Txt_wrong_ANSWERS ,Print->NumQsts.Valid.Wrong.Zero, + Txt_wrong_ANSWERS ,Print->NumQsts.Valid.Wrong.Positive, + Txt_blank_ANSWERS ,Print->NumQsts.Valid.Blank); + else + Ico_PutIconNotVisible (); + HTM_TD_End (); + + HTM_TR_End (); + /***** Score *****/ HTM_TR_Begin (NULL); @@ -1370,27 +1535,27 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, HTM_TxtColon (Txt_Score); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (ICanView.Score) { /* Score counting all questions */ - if (Print->NumQsts.All == Print->NumQsts.Valid) + if (Print->NumQsts.All == Print->NumQsts.Valid.Total) HTM_STRONG_Begin (); HTM_Double2Decimals (Print->Score.All); HTM_Txt ("/"); HTM_Unsigned (Print->NumQsts.All); - if (Print->NumQsts.All == Print->NumQsts.Valid) + if (Print->NumQsts.All == Print->NumQsts.Valid.Total) HTM_STRONG_End (); /* Scoure counting only valid questions */ - if (Print->NumQsts.All != Print->NumQsts.Valid) + if (Print->NumQsts.All != Print->NumQsts.Valid.Total) { HTM_Txt ("; "); HTM_TxtColonNBSP (Txt_valid_score); HTM_STRONG_Begin (); HTM_Double2Decimals (Print->Score.Valid); HTM_Txt ("/"); - HTM_Unsigned (Print->NumQsts.Valid); + HTM_Unsigned (Print->NumQsts.Valid.Total); HTM_STRONG_End (); } } @@ -1407,23 +1572,23 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, HTM_TxtColon (Txt_Grade); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (ICanView.Score) { /* Grade counting all questions */ - if (Print->NumQsts.All == Print->NumQsts.Valid) + if (Print->NumQsts.All == Print->NumQsts.Valid.Total) HTM_STRONG_Begin (); TstPrn_ComputeAndShowGrade (Print->NumQsts.All,Print->Score.All,Exam->MaxGrade); - if (Print->NumQsts.All == Print->NumQsts.Valid) + if (Print->NumQsts.All == Print->NumQsts.Valid.Total) HTM_STRONG_End (); /* Grade counting only valid questions */ - if (Print->NumQsts.All != Print->NumQsts.Valid) + if (Print->NumQsts.All != Print->NumQsts.Valid.Total) { HTM_Txt ("; "); HTM_TxtColonNBSP (Txt_valid_grade); HTM_STRONG_Begin (); - TstPrn_ComputeAndShowGrade (Print->NumQsts.Valid,Print->Score.Valid,Exam->MaxGrade); + TstPrn_ComputeAndShowGrade (Print->NumQsts.Valid.Total,Print->Score.Valid,Exam->MaxGrade); HTM_STRONG_End (); } } @@ -1503,7 +1668,12 @@ static void ExaRes_ComputeValidPrintScore (struct ExaPrn_Print *Print) bool QuestionExists; /***** Initialize score valid *****/ - Print->NumQsts.Valid = 0; + Print->NumQsts.Valid.Correct = + Print->NumQsts.Valid.Wrong.Negative = + Print->NumQsts.Valid.Wrong.Zero = + Print->NumQsts.Valid.Wrong.Positive = + Print->NumQsts.Valid.Blank = + Print->NumQsts.Valid.Total = 0; Print->Score.Valid = 0.0; for (NumQst = 0; @@ -1540,7 +1710,25 @@ static void ExaRes_ComputeValidPrintScore (struct ExaPrn_Print *Print) if (Question.Validity == Tst_VALID_QUESTION) { ExaPrn_ComputeAnswerScore (&Print->PrintedQuestions[NumQst],&Question); - Print->NumQsts.Valid++; + switch (Print->PrintedQuestions[NumQst].AnswerIsCorrect) + { + case TstPrn_ANSWER_IS_CORRECT: + Print->NumQsts.Valid.Correct++; + break; + case TstPrn_ANSWER_IS_WRONG_NEGATIVE: + Print->NumQsts.Valid.Wrong.Negative++; + break; + case TstPrn_ANSWER_IS_WRONG_ZERO: + Print->NumQsts.Valid.Wrong.Zero++; + break; + case TstPrn_ANSWER_IS_WRONG_POSITIVE: + Print->NumQsts.Valid.Wrong.Positive++; + break; + case TstPrn_ANSWER_IS_BLANK: + Print->NumQsts.Valid.Blank++; + break; + } + Print->NumQsts.Valid.Total++; Print->Score.Valid += Print->PrintedQuestions[NumQst].Score; } } diff --git a/swad_figure.c b/swad_figure.c index eebafe90..c29fa6af 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -431,7 +431,7 @@ static void Fig_GetAndShowNumUsrsInCrss (Rol_Role_t Role) (Gbl.Scope.Current == Hie_DEG ? Gbl.Hierarchy.Deg.DegCod : (Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.CrsCod : -1L))))); - char *Class = (Role == Rol_UNK) ? "DAT_N_LINE_TOP RB" : + char *Class = (Role == Rol_UNK) ? "DAT_N LINE_TOP RB" : "DAT RB"; unsigned Roles = (Role == Rol_UNK) ? ((1 << Rol_STD) | (1 << Rol_NET) | @@ -959,7 +959,7 @@ static void Fig_GetAndShowHierarchyTotal (void) /***** Write total number of elements *****/ Fig_ShowHierarchyRow ("",Txt_Total, - "DAT_N_LINE_TOP", + "DAT_N LINE_TOP", (int) NumCtysTotal, (int) NumInssTotal, (int) NumCtrsTotal, @@ -2577,7 +2577,7 @@ static void Fig_WriteRowStatsFileBrowsers1 (const char *NameOfFileZones, char StrNumGrps[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char StrNumUsrs[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char FileSizeStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1]; - char *Class = (FileZone == Brw_UNKNOWN) ? "DAT_N_LINE_TOP" : + char *Class = (FileZone == Brw_UNKNOWN) ? "DAT_N LINE_TOP" : "DAT"; Fil_WriteFileSizeFull ((double) SizeOfFileZones->Size,FileSizeStr); @@ -2650,7 +2650,7 @@ static void Fig_WriteRowStatsFileBrowsers2 (const char *NameOfFileZones, char StrNumFoldersPerCrs[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char StrNumFilesPerCrs[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char FileSizePerCrsStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1]; - char *Class = (FileZone == Brw_UNKNOWN) ? "DAT_N_LINE_TOP" : + char *Class = (FileZone == Brw_UNKNOWN) ? "DAT_N LINE_TOP" : "DAT"; if (SizeOfFileZones->NumCrss == -1) // Not applicable @@ -2708,7 +2708,7 @@ static void Fig_WriteRowStatsFileBrowsers3 (const char *NameOfFileZones, char StrNumFoldersPerUsr[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char StrNumFilesPerUsr[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char FileSizePerUsrStr[Fil_MAX_BYTES_FILE_SIZE_STRING + 1]; - char *Class = (FileZone == Brw_UNKNOWN) ? "DAT_N_LINE_TOP" : + char *Class = (FileZone == Brw_UNKNOWN) ? "DAT_N LINE_TOP" : "DAT"; if (SizeOfFileZones->NumUsrs == -1) // Not applicable @@ -3138,7 +3138,7 @@ static void Fig_GetAndShowTestsStats (void) extern const char *Txt_Number_of_BR_times_that_BR_questions_BR_have_been_BR_responded; extern const char *Txt_Average_BR_number_of_BR_times_that_BR_questions_BR_have_been_BR_responded_BR_per_course; extern const char *Txt_Average_BR_number_of_BR_times_that_BR_a_question_BR_has_been_BR_responded; - extern const char *Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1; + extern const char *Txt_Average_BR_score_BR_per_question; extern const char *Txt_TST_STR_ANSWER_TYPES[Tst_NUM_ANS_TYPES]; extern const char *Txt_Total; Tst_AnswerType_t AnsType; @@ -3160,7 +3160,7 @@ static void Fig_GetAndShowTestsStats (void) HTM_TH (1,1,"RM",Txt_Number_of_BR_times_that_BR_questions_BR_have_been_BR_responded); HTM_TH (1,1,"RM",Txt_Average_BR_number_of_BR_times_that_BR_questions_BR_have_been_BR_responded_BR_per_course); HTM_TH (1,1,"RM",Txt_Average_BR_number_of_BR_times_that_BR_a_question_BR_has_been_BR_responded); - HTM_TH (1,1,"RM",Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1); + HTM_TH (1,1,"RM",Txt_Average_BR_score_BR_per_question); HTM_TR_End (); @@ -3223,15 +3223,15 @@ static void Fig_GetAndShowTestsStats (void) /***** Write number of assignments *****/ HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP LM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LM\""); HTM_Txt (Txt_Total); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (Stats.NumCoursesWithQuestions); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_TxtF ("%u (%.1f%%)", Stats.NumCoursesWithPluggableQuestions, Stats.NumCoursesWithQuestions ? (double) Stats.NumCoursesWithPluggableQuestions * 100.0 / @@ -3239,27 +3239,27 @@ static void Fig_GetAndShowTestsStats (void) 0.0); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (Stats.NumQsts); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Double2Decimals (Stats.AvgQstsPerCourse); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_UnsignedLong (Stats.NumHits); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Double2Decimals (Stats.AvgHitsPerCourse); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Double2Decimals (Stats.AvgHitsPerQuestion); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Double2Decimals (Stats.AvgScorePerQuestion); HTM_TD_End (); @@ -3661,25 +3661,25 @@ static void Fig_GetAndShowTimelineActivityStats (void) /* Write totals */ HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP LM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LM\""); HTM_Txt (Txt_Total); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_UnsignedLong (NumNotes); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (NumUsrs); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Percentage (NumUsrsTotal ? (double) NumUsrs * 100.0 / (double) NumUsrsTotal : 0.0); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Double2Decimals (NumUsrs ? (double) NumNotes / (double) NumUsrs : 0.0); HTM_TD_End (); @@ -4288,38 +4288,38 @@ static void Fig_WriteForumTotalStats (struct Fig_FiguresForum *FiguresForum) /***** Write forum name and stats *****/ HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP\" style=\"width:20px;\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP\" style=\"width:20px;\""); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP LM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LM\""); HTM_Txt (Txt_Total); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (FiguresForum->NumForums); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (FiguresForum->NumThreads); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (FiguresForum->NumPosts); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (FiguresForum->NumUsrsToBeNotifiedByEMail); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Double2Decimals (NumThrsPerForum); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Double2Decimals (NumPostsPerThread); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Double2Decimals (NumPostsPerForum); HTM_TD_End (); @@ -4530,25 +4530,25 @@ static void Fig_GetAndShowNumUsrsPerNotifyEvent (void) /***** Write total number of users who want to be notified by email on some event *****/ HTM_TR_Begin (NULL); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP LM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP LM\""); HTM_Txt (Txt_Total); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (NumUsrsTotalWhoWantToBeNotifiedByEMailAboutSomeEvent); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Percentage (NumUsrsTotal ? (double) NumUsrsTotalWhoWantToBeNotifiedByEMailAboutSomeEvent * 100.0 / (double) NumUsrsTotal : 0.0); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (NumEventsTotal); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (NumMailsTotal); HTM_TD_End (); diff --git a/swad_indicator.c b/swad_indicator.c index 5f0a5d86..22c9d50f 100644 --- a/swad_indicator.c +++ b/swad_indicator.c @@ -707,15 +707,15 @@ static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indic if (PutForm) HTM_TD_Empty (1); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Txt (Txt_Total); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_Unsigned (NumCrss); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM\""); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM\""); HTM_TxtF ("(%.1f%%)",100.0); HTM_TD_End (); diff --git a/swad_match_result.c b/swad_match_result.c index 6b1a551c..c97635c7 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -614,7 +614,7 @@ static void MchRes_ShowResultsBegin (struct Gam_Games *Games, /***** Begin match results table *****/ HTM_SECTION_Begin (MchRes_RESULTS_TABLE_ID); - HTM_TABLE_BeginWidePadding (2); + HTM_TABLE_BeginWidePadding (5); } static void MchRes_ShowResultsEnd (void) @@ -735,7 +735,7 @@ static void MchRes_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther) extern const char *Txt_Questions; extern const char *Txt_Non_blank_BR_questions; extern const char *Txt_Score; - extern const char *Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1; + extern const char *Txt_Average_BR_score_BR_per_question; extern const char *Txt_Grade; HTM_TR_Begin (NULL); @@ -748,7 +748,7 @@ static void MchRes_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther) HTM_TH (1,1,"RT",Txt_Questions); HTM_TH (1,1,"RT",Txt_Non_blank_BR_questions); HTM_TH (1,1,"RT",Txt_Score); - HTM_TH (1,1,"RT",Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1); + HTM_TH (1,1,"RT",Txt_Average_BR_score_BR_per_question); HTM_TH (1,1,"RT",Txt_Grade); HTM_TH_Empty (1); @@ -1082,44 +1082,44 @@ static void MchRes_ShowMchResultsSummaryRow (unsigned NumResults, HTM_TR_Begin (NULL); /***** Row title *****/ - HTM_TD_Begin ("colspan=\"3\" class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("colspan=\"3\" class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); HTM_TxtColonNBSP (Txt_Matches); HTM_Unsigned (NumResults); HTM_TD_End (); /***** Write total number of questions *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); if (NumResults) HTM_Unsigned (NumTotalQsts); HTM_TD_End (); /***** Write total number of questions not blank *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); if (NumResults) HTM_Unsigned (NumTotalQstsNotBlank); HTM_TD_End (); /***** Write total score *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); HTM_Double2Decimals (TotalScoreOfAllResults); HTM_Txt ("/"); HTM_Unsigned (NumTotalQsts); HTM_TD_End (); /***** Write average score per question *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); HTM_Double2Decimals (NumTotalQsts ? TotalScoreOfAllResults / (double) NumTotalQsts : 0.0); HTM_TD_End (); /***** Write total grade *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); HTM_Double2Decimals (TotalGrade); HTM_TD_End (); /***** Last cell *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_End (); /***** End row *****/ @@ -1137,7 +1137,7 @@ void MchRes_ShowOneMchResult (void) extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; extern const char *Txt_Questions; - extern const char *Txt_QUESTIONS_non_blank; + extern const char *Txt_Answers; extern const char *Txt_Score; extern const char *Txt_Grade; extern const char *Txt_Tags; @@ -1242,7 +1242,7 @@ void MchRes_ShowOneMchResult (void) HTM_TxtColon (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs.Role][UsrDat->Sex]); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); ID_WriteUsrIDs (UsrDat,NULL); HTM_TxtF (" %s",UsrDat->Surname1); if (UsrDat->Surname2[0]) @@ -1271,7 +1271,7 @@ void MchRes_ShowOneMchResult (void) if (asprintf (&Id,"match_%u",(unsigned) StartEndTime) < 0) Lay_NotEnoughMemoryExit (); - HTM_TD_Begin ("id=\"%s\" class=\"DAT LT\"",Id); + HTM_TD_Begin ("id=\"%s\" class=\"DAT LB\"",Id); Dat_WriteLocalDateHMSFromUTC (Id,Print.TimeUTC[StartEndTime], Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA, true,true,true,0x7); @@ -1288,9 +1288,21 @@ void MchRes_ShowOneMchResult (void) HTM_TxtColon (Txt_Questions); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); - HTM_TxtF ("%u; %s: %u", - Print.NumQsts,Txt_QUESTIONS_non_blank,Print.NumQstsNotBlank); + HTM_TD_Begin ("class=\"DAT LB\""); + HTM_Unsigned (Print.NumQsts); + HTM_TD_End (); + + HTM_TR_End (); + + /***** Number of answers *****/ + HTM_TR_Begin (NULL); + + HTM_TD_Begin ("class=\"DAT_N RT\""); + HTM_TxtColon (Txt_Answers); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT LB\""); + HTM_Unsigned (Print.NumQstsNotBlank); HTM_TD_End (); HTM_TR_End (); @@ -1302,7 +1314,7 @@ void MchRes_ShowOneMchResult (void) HTM_TxtColon (Txt_Score); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (ICanViewScore) { HTM_STRONG_Begin (); @@ -1324,7 +1336,7 @@ void MchRes_ShowOneMchResult (void) HTM_TxtColon (Txt_Grade); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (ICanViewScore) { HTM_STRONG_Begin (); @@ -1344,7 +1356,7 @@ void MchRes_ShowOneMchResult (void) HTM_TxtColon (Txt_Tags); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); Gam_ShowTstTagsPresentInAGame (Match.GamCod); HTM_TD_End (); diff --git a/swad_test_print.c b/swad_test_print.c index c1cc18b7..3e5a50e4 100644 --- a/swad_test_print.c +++ b/swad_test_print.c @@ -187,7 +187,7 @@ static void TstPrn_ResetPrintExceptPrnCod (struct TstPrn_Print *Print) { Print->TimeUTC[Dat_START_TIME] = Print->TimeUTC[Dat_END_TIME ] = (time_t) 0; - Print->NumQsts = + Print->NumQsts = 0; Print->NumQstsNotBlank = 0; Print->Sent = false; // After creating an exam, it's not sent Print->AllowTeachers = false; // Teachers can't seen the exam if student don't allow it @@ -1026,11 +1026,19 @@ void TstPrn_ComputeIntAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, { long AnswerUsr; + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_BLANK; PrintedQuestion->Score = 0.0; // Default score for blank or wrong answer + if (PrintedQuestion->StrAnswers[0]) // If user has answered the answer + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_ZERO; if (sscanf (PrintedQuestion->StrAnswers,"%ld",&AnswerUsr) == 1) if (AnswerUsr == Question->Answer.Integer) // Correct answer + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_CORRECT; PrintedQuestion->Score = 1.0; + } + } } void TstPrn_ComputeFltAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, @@ -1038,30 +1046,47 @@ void TstPrn_ComputeFltAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, { double AnswerUsr; + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_BLANK; PrintedQuestion->Score = 0.0; // Default score for blank or wrong answer + if (PrintedQuestion->StrAnswers[0]) // If user has answered the answer { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_ZERO; AnswerUsr = Str_GetDoubleFromStr (PrintedQuestion->StrAnswers); // A bad formatted floating point answer will interpreted as 0.0 - PrintedQuestion->Score = (AnswerUsr >= Question->Answer.FloatingPoint[0] && - AnswerUsr <= Question->Answer.FloatingPoint[1]) ? 1.0 : // If correct (inside the interval) - 0.0; // If wrong (outside the interval) + if (AnswerUsr >= Question->Answer.FloatingPoint[0] && + AnswerUsr <= Question->Answer.FloatingPoint[1]) + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_CORRECT; + PrintedQuestion->Score = 1.0; // Correct (inside the interval) + } } } void TstPrn_ComputeTF_AnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, const struct Tst_Question *Question) { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_BLANK; + PrintedQuestion->Score = 0.0; + if (PrintedQuestion->StrAnswers[0]) // If user has selected T or F - PrintedQuestion->Score = (PrintedQuestion->StrAnswers[0] == Question->Answer.TF) ? 1.0 : // Correct - -1.0; // Wrong - else - PrintedQuestion->Score = 0.0; + { + if (PrintedQuestion->StrAnswers[0] == Question->Answer.TF) + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_CORRECT; + PrintedQuestion->Score = 1.0; // Correct + } + else + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_NEGATIVE; + PrintedQuestion->Score = -1.0; // Wrong + } + } } void TstPrn_ComputeChoAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, - const struct Tst_Question *Question) + const struct Tst_Question *Question) { unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]; // Indexes of all answers of this question bool UsrAnswers[Tst_MAX_OPTIONS_PER_QUESTION]; @@ -1071,6 +1096,9 @@ void TstPrn_ComputeChoAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, unsigned NumAnsGood = 0; unsigned NumAnsBad = 0; + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_BLANK; + PrintedQuestion->Score = 0.0; + /***** Get indexes for this question from string *****/ TstPrn_GetIndexesFromStr (PrintedQuestion->StrIndexes,Indexes); @@ -1095,39 +1123,68 @@ void TstPrn_ComputeChoAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, } } - /* The answer is blank? */ + /* The answer is not blank? */ if (NumAnsGood || NumAnsBad) // If user has answered the answer { /* Compute the score */ if (Question->Answer.Type == Tst_ANS_UNIQUE_CHOICE) { if (NumOptTotInQst >= 2) // It should be 2 options at least - PrintedQuestion->Score = (double) NumAnsGood - - (double) NumAnsBad / (double) (NumOptTotInQst - 1); - else // 0 or 1 options (impossible) - PrintedQuestion->Score = (double) NumAnsGood; + { + if (NumAnsGood == 1 && NumAnsBad == 0) + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_CORRECT; + PrintedQuestion->Score = 1; + } + else if (NumAnsGood == 0 && NumAnsBad == 1) + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_NEGATIVE; + PrintedQuestion->Score = -1.0 / (double) (NumOptTotInQst - 1); + } + // other case should be impossible + } + // other case should be impossible } else // AnswerType == Tst_ANS_MULTIPLE_CHOICE { if (NumOptCorrInQst) // There are correct options in the question { - if (NumOptCorrInQst < NumOptTotInQst) // If there are correct options and wrong options (typical case) - PrintedQuestion->Score = (double) NumAnsGood / (double) NumOptCorrInQst - - (double) NumAnsBad / (double) (NumOptTotInQst - NumOptCorrInQst); - else // If all options are correct (extrange case) - PrintedQuestion->Score = (double) NumAnsGood / (double) NumOptCorrInQst; - } - else - { - if (NumOptTotInQst) // There are options but none is correct (extrange case) - PrintedQuestion->Score = - (double) NumAnsBad / (double) NumOptTotInQst; - else // There are no options (impossible!) - PrintedQuestion->Score = 0.0; + if (NumAnsGood == NumOptCorrInQst && NumAnsBad == 0) + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_CORRECT; + PrintedQuestion->Score = 1.0; + } + else + { + if (NumOptCorrInQst < NumOptTotInQst) // If there are correct options and wrong options (typical case) + { + PrintedQuestion->Score = (double) NumAnsGood / (double) NumOptCorrInQst - + (double) NumAnsBad / (double) (NumOptTotInQst - NumOptCorrInQst); + if (PrintedQuestion->Score > 0.000001) + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_POSITIVE; + else if (PrintedQuestion->Score < -0.000001) + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_NEGATIVE; + else // Score is 0 + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_ZERO; + } + else // If all options are correct (extrange case) + { + if (NumAnsGood == 0) + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_ZERO; + PrintedQuestion->Score = 0.0; + } + else + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_POSITIVE; + PrintedQuestion->Score = (double) NumAnsGood / (double) NumOptCorrInQst; + } + } + } } + // other case should be impossible } } - else // Answer is blank - PrintedQuestion->Score = 0.0; } void TstPrn_ComputeTxtAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, @@ -1137,7 +1194,9 @@ void TstPrn_ComputeTxtAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, char TextAnsUsr[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; char TextAnsOK[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_BLANK; PrintedQuestion->Score = 0.0; // Default score for blank or wrong answer + if (PrintedQuestion->StrAnswers[0]) // If user has answered the answer { /* Filter the user answer */ @@ -1149,6 +1208,7 @@ void TstPrn_ComputeTxtAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, Str_ReplaceSeveralSpacesForOne (TextAnsUsr); Str_ConvertToComparable (TextAnsUsr); + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_WRONG_ZERO; for (NumOpt = 0; NumOpt < Question->Answer.NumOptions; NumOpt++) @@ -1160,7 +1220,11 @@ void TstPrn_ComputeTxtAnsScore (struct TstPrn_PrintedQuestion *PrintedQuestion, /* Check is user answer is correct */ if (!strcoll (TextAnsUsr,TextAnsOK)) + { + PrintedQuestion->AnswerIsCorrect = TstPrn_ANSWER_IS_CORRECT; PrintedQuestion->Score = 1.0; // Correct answer + break; + } } } } @@ -1889,7 +1953,7 @@ static void TstPrn_ShowUsrsPrints (__attribute__((unused)) void *Args) /***** Begin box and table *****/ Box_BoxTableBegin (NULL,Txt_Results, NULL,NULL, - Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE,2); + Hlp_ASSESSMENT_Tests_results,Box_NOT_CLOSABLE,5); /***** Header of the table with the list of users *****/ TstPrn_ShowHeaderPrints (); @@ -1925,7 +1989,7 @@ static void TstPrn_ShowHeaderPrints (void) extern const char *Txt_Questions; extern const char *Txt_Non_blank_BR_questions; extern const char *Txt_Score; - extern const char *Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1; + extern const char *Txt_Average_BR_score_BR_per_question; extern const char *Txt_Grade; HTM_TR_Begin (NULL); @@ -1936,7 +2000,7 @@ static void TstPrn_ShowHeaderPrints (void) HTM_TH (1,1,"RT",Txt_Questions); HTM_TH (1,1,"RT",Txt_Non_blank_BR_questions); HTM_TH (1,1,"RT",Txt_Score); - HTM_TH (1,1,"RT",Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1); + HTM_TH (1,1,"RT",Txt_Average_BR_score_BR_per_question); HTM_TH (1,1,"RT",Txt_Grade); HTM_TH_Empty (1); @@ -2223,25 +2287,25 @@ static void TstPrn_ShowPrintsSummaryRow (bool ItsMe, HTM_TR_Begin (NULL); /***** Row title *****/ - HTM_TD_Begin ("colspan=\"2\" class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("colspan=\"2\" class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); HTM_TxtColonNBSP (Txt_Visible_tests); HTM_Unsigned (NumPrints); HTM_TD_End (); /***** Write total number of questions *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); if (NumPrints) HTM_Unsigned (NumTotalQsts); HTM_TD_End (); /***** Write total number of questions not blank *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); if (NumPrints) HTM_Unsigned (NumTotalQstsNotBlank); HTM_TD_End (); /***** Write total score *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); if (ICanViewTotalScore) { HTM_Double2Decimals (TotalScoreOfAllTests); @@ -2251,20 +2315,20 @@ static void TstPrn_ShowPrintsSummaryRow (bool ItsMe, HTM_TD_End (); /***** Write average score per question *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); if (ICanViewTotalScore) HTM_Double2Decimals (NumTotalQsts ? TotalScoreOfAllTests / (double) NumTotalQsts : 0.0); HTM_TD_End (); /***** Write score over Tst_SCORE_MAX *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP RM COLOR%u\"",Gbl.RowEvenOdd); if (ICanViewTotalScore) TstPrn_ComputeAndShowGrade (NumTotalQsts,TotalScoreOfAllTests,Tst_SCORE_MAX); HTM_TD_End (); /***** Last cell *****/ - HTM_TD_Begin ("class=\"DAT_N_LINE_TOP COLOR%u\"",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT_N LINE_TOP COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_End (); /***** End row *****/ @@ -2283,7 +2347,7 @@ void TstPrn_ShowOnePrint (void) extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; extern const char *Txt_Questions; - extern const char *Txt_QUESTIONS_non_blank; + extern const char *Txt_Answers; extern const char *Txt_Score; extern const char *Txt_Grade; extern const char *Txt_Tags; @@ -2381,7 +2445,7 @@ void TstPrn_ShowOnePrint (void) HTM_TxtColon (Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Other.UsrDat.Sex]); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); ID_WriteUsrIDs (&Gbl.Usrs.Other.UsrDat,NULL); HTM_TxtF (" %s",Gbl.Usrs.Other.UsrDat.Surname1); if (Gbl.Usrs.Other.UsrDat.Surname2[0]) @@ -2411,7 +2475,7 @@ void TstPrn_ShowOnePrint (void) HTM_TxtColon (Txt_START_END_TIME[StartEndTime]); HTM_TD_End (); - HTM_TD_Begin ("id=\"%s\" class=\"DAT LT\"",Id); + HTM_TD_Begin ("id=\"%s\" class=\"DAT LB\"",Id); Dat_WriteLocalDateHMSFromUTC (Id,Print.TimeUTC[StartEndTime], Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA, true,true,true,0x7); @@ -2429,9 +2493,21 @@ void TstPrn_ShowOnePrint (void) HTM_TxtColon (Txt_Questions); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); - HTM_TxtF ("%u; %s: %u", - Print.NumQsts,Txt_QUESTIONS_non_blank,Print.NumQstsNotBlank); + HTM_TD_Begin ("class=\"DAT LB\""); + HTM_Unsigned (Print.NumQsts); + HTM_TD_End (); + + HTM_TR_End (); + + /***** Number of answers *****/ + HTM_TR_Begin (NULL); + + HTM_TD_Begin ("class=\"DAT_N RT\""); + HTM_TxtColon (Txt_Answers); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"DAT LB\""); + HTM_Unsigned (Print.NumQstsNotBlank); HTM_TD_End (); HTM_TR_End (); @@ -2443,7 +2519,7 @@ void TstPrn_ShowOnePrint (void) HTM_TxtColon (Txt_Score); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (ICanViewScore) { HTM_STRONG_Begin (); @@ -2463,7 +2539,7 @@ void TstPrn_ShowOnePrint (void) HTM_TxtColon (Txt_Grade); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); if (ICanViewScore) { HTM_STRONG_Begin (); @@ -2483,7 +2559,7 @@ void TstPrn_ShowOnePrint (void) HTM_TxtColon (Txt_Tags); HTM_TD_End (); - HTM_TD_Begin ("class=\"DAT LT\""); + HTM_TD_Begin ("class=\"DAT LB\""); TstPrn_ShowTagsPresentInAPrint (Print.PrnCod); HTM_TD_End (); diff --git a/swad_test_print.h b/swad_test_print.h index 24cdc934..369988cd 100644 --- a/swad_test_print.h +++ b/swad_test_print.h @@ -40,13 +40,23 @@ /******************************* Public types ********************************/ /*****************************************************************************/ +typedef enum + { + TstPrn_ANSWER_IS_CORRECT, + TstPrn_ANSWER_IS_WRONG_NEGATIVE, + TstPrn_ANSWER_IS_WRONG_ZERO, + TstPrn_ANSWER_IS_WRONG_POSITIVE, + TstPrn_ANSWER_IS_BLANK, + } TstPrn_Correct_t; + struct TstPrn_PrintedQuestion { long QstCod; // Question code long SetCod; // Only for exams char StrIndexes[Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc. char StrAnswers[Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user - double Score; // Question score + TstPrn_Correct_t AnswerIsCorrect; // Is question wrong, medium or correct? + double Score; // Question score }; struct TstPrn_Print diff --git a/swad_text.c b/swad_text.c index 45223ca8..7ac7f09c 100644 --- a/swad_text.c +++ b/swad_text.c @@ -2522,6 +2522,27 @@ const char *Txt_Availability = "Disponibilidade"; #endif +const char *Txt_average = +#if L==1 // ca + "mitjana"; +#elif L==2 // de + "Mittel"; +#elif L==3 // en + "average"; +#elif L==4 // es + "media"; +#elif L==5 // fr + "moyenne"; +#elif L==6 // gn + "media"; // Okoteve traducción +#elif L==7 // it + "media"; +#elif L==8 // pl + "średnia"; +#elif L==9 // pt + "média"; +#endif + const char *Txt_Average_number_BR_of_ASSIG_BR_per_course = #if L==1 // ca "Nombre mitj´
d'activitats
per assignatura"; @@ -2819,25 +2840,25 @@ const char *Txt_AVERAGE_PHOTO_TYPES[Pho_NUM_AVERAGE_PHOTO_TYPES] = #endif }; -const char *Txt_Average_BR_score_BR_per_question_BR_less_than_or_equal_to_1 = +const char *Txt_Average_BR_score_BR_per_question = #if L==1 // ca - "Puntuació
mitjana
per pregunta
(≤1)"; + "Puntuació
mitjana
per pregunta"; #elif L==2 // de - "Durchschnittliche
Punktzahl
pro Frage
(≤1)"; + "Durchschnittliche
Punktzahl
pro Frage"; #elif L==3 // en - "Average
score
per question
(≤1)"; + "Average
score
per question"; #elif L==4 // es - "Puntuación
media
por pregunta
(≤1)"; + "Puntuación
media
por pregunta"; #elif L==5 // fr - "Score
moyen
par question
(≤1)"; + "Score
moyen
par question"; #elif L==6 // gn - "Puntuación
media
por pregunta
(≤1)"; // Okoteve traducción + "Puntuación
media
por pregunta"; // Okoteve traducción #elif L==7 // it - "Punteggio
medio
per domanda
(≤1)"; + "Punteggio
medio
per domanda"; #elif L==8 // pl - "Średnia
ocena
za pytanie
(≤1)"; + "Średnia
ocena
za pytanie"; #elif L==9 // pt - "Pontuação
média por
pergunta
(≤1)"; + "Pontuação
média por
pergunta"; #endif const char *Txt_Average_type = @@ -3086,6 +3107,27 @@ const char *Txt_Before_going_to_any_other_option_you_must_fill_in_your_email_add "você deve preencher seu endereço de email."; #endif +const char *Txt_blank_ANSWERS = +#if L==1 // ca + "en blanc"; +#elif L==2 // de + "leere"; +#elif L==3 // en + "blank"; +#elif L==4 // es + "en blanco"; +#elif L==5 // fr + "vides"; +#elif L==6 // gn + "en blanco"; // Okoteve traducción +#elif L==7 // it + "vuote"; +#elif L==8 // pl + "puste"; +#elif L==9 // pt + "em branco"; +#endif + const char *Txt_Briefcase_of_THE_USER_X_has_been_removed = // Warning: it is very important to include %s in the following sentences #if L==1 // ca "Se ha eliminado el maletín de %s."; // Necessita traduccio @@ -4988,6 +5030,27 @@ const char *Txt_Copy_source = "Origem da copia"; #endif +const char *Txt_correct_ANSWERS = +#if L==1 // ca + "correctes"; +#elif L==2 // de + "richtige"; +#elif L==3 // en + "correct"; +#elif L==4 // es + "correctas"; +#elif L==5 // fr + "bonnes"; +#elif L==6 // gn + "correctas"; // Okoteve traducción +#elif L==7 // it + "corrette"; +#elif L==8 // pl + "prawidłowe"; +#elif L==9 // pt + "corretas"; +#endif + const char *Txt_Could_not_detect_any_face_in_front_position_ = #if L==1 // ca "No s'ha detectat cap rostre en posició frontal."; @@ -33056,27 +33119,6 @@ const char *Txt_Questions_and_problems = "Perguntas e problemas"; #endif -const char *Txt_QUESTIONS_non_blank = -#if L==1 // ca - "contestades"; -#elif L==2 // de - "Non-blank"; -#elif L==3 // en - "non-blank"; -#elif L==4 // es - "contestadas"; -#elif L==5 // fr - "non vide"; -#elif L==6 // gn - "contestadas"; // Okoteve traducción -#elif L==7 // it - "risposte"; -#elif L==8 // pl - "niepustych"; -#elif L==9 // pt - "respondidas"; -#endif - const char *Txt_QUESTIONS_invalid = #if L==1 // ca "anul·lades"; @@ -53694,6 +53736,27 @@ const char *Txt_Total = "Total"; #endif +const char *Txt_total = +#if L==1 // ca + "total"; +#elif L==2 // de + "Gesamtzahl"; +#elif L==3 // en + "total"; +#elif L==4 // es + "total"; +#elif L==5 // fr + "total"; +#elif L==6 // gn + "total"; // Okoteve traducción +#elif L==7 // it + "totale"; +#elif L==8 // pl + "całkowity"; +#elif L==9 // pt + "total"; +#endif + const char *Txt_TST_Answer_given_by_the_teachers = #if L==1 // ca "Resposta donada pels professors"; @@ -56008,6 +56071,27 @@ const char *Txt_Vacants = "Desocupados"; #endif +const char *Txt_Valid_answers = +#if L==1 // ca + "Respostes vàlides"; +#elif L==2 // de + "Gültige Antworten"; +#elif L==3 // en + "Valid answers"; +#elif L==4 // es + "Respuestas válidas"; +#elif L==5 // fr + "Réponses valides"; +#elif L==6 // gn + "Respuestas válidas"; // Okoteve traducción +#elif L==7 // it + "Risposte valide"; +#elif L==8 // pl + "Prawidłowe odpowiedzi"; +#elif L==9 // pt + "Respostas válidas"; +#endif + const char *Txt_valid_grade = #if L==1 // ca "nota vàlida"; @@ -57106,6 +57190,27 @@ const char *Txt_Write_a_message = "Escrever uma mensagem"; #endif +const char *Txt_wrong_ANSWERS = +#if L==1 // ca + "incorrectes"; +#elif L==2 // de + "falsche"; +#elif L==3 // en + "wrong"; +#elif L==4 // es + "erróneas"; +#elif L==5 // fr + "mauvaises"; +#elif L==6 // gn + "erróneas"; // Okoteve traducción +#elif L==7 // it + "sbagliate"; +#elif L==8 // pl + "złe"; +#elif L==9 // pt + "erradas"; +#endif + const char *Txt_Wrong_file_type = #if L==1 // ca "Tipus d'arxiu incorrecte.";