mirror of https://github.com/acanas/swad-core.git
Version19.255.2
This commit is contained in:
parent
0b8f1357e0
commit
0d6621862c
|
@ -556,7 +556,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.255.1 (2020-06-23)"
|
#define Log_PLATFORM_VERSION "SWAD 19.255.2 (2020-06-24)"
|
||||||
#define CSS_FILE "swad19.253.css"
|
#define CSS_FILE "swad19.253.css"
|
||||||
#define JS_FILE "swad19.254.js"
|
#define JS_FILE "swad19.254.js"
|
||||||
/*
|
/*
|
||||||
|
@ -567,6 +567,7 @@ TODO: Fix bug: Cuando se pulsa en ver fichas, y luego en una ficha en "Ver traba
|
||||||
TODO: No limitar el número de preguntas en un examen a ExaPrn_MAX_QUESTIONS_PER_EXAM_PRINT, sino asignar PrintedQuestions dinámicamente con malloc
|
TODO: No limitar el número de preguntas en un examen a ExaPrn_MAX_QUESTIONS_PER_EXAM_PRINT, sino asignar PrintedQuestions dinámicamente con malloc
|
||||||
TODO: Que al generar un examen sólo se cojan preguntas válidas. Y si ya está generado, al entrar de nuevo, que se vean en rojo.
|
TODO: Que al generar un examen sólo se cojan preguntas válidas. Y si ya está generado, al entrar de nuevo, que se vean en rojo.
|
||||||
|
|
||||||
|
Version 19.255.2: Jun 24, 2020 Changes in listing of test and exam results. (303701 lines)
|
||||||
Version 19.255.1: Jun 23, 2020 Changes in listing of test results. (303655 lines)
|
Version 19.255.1: Jun 23, 2020 Changes in listing of test results. (303655 lines)
|
||||||
Version 19.255: Jun 23, 2020 Code refactoring in test results. (303625 lines)
|
Version 19.255: Jun 23, 2020 Code refactoring in test results. (303625 lines)
|
||||||
Version 19.254.2: Jun 23, 2020 Matches results can only be changed to visible when match is at the end.
|
Version 19.254.2: Jun 23, 2020 Matches results can only be changed to visible when match is at the end.
|
||||||
|
|
|
@ -531,7 +531,7 @@ static void ExaPrn_CreatePrintInDB (struct ExaPrn_Print *Print)
|
||||||
" (%ld,%ld,NOW(),NOW(),%u,0,'N',0)",
|
" (%ld,%ld,NOW(),NOW(),%u,0,'N',0)",
|
||||||
Print->SesCod,
|
Print->SesCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Print->NumQsts);
|
Print->NumQsts.All);
|
||||||
|
|
||||||
/***** Store all questions (with blank answers)
|
/***** Store all questions (with blank answers)
|
||||||
of this exam print just generated in database *****/
|
of this exam print just generated in database *****/
|
||||||
|
|
|
@ -716,25 +716,25 @@ static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther)
|
||||||
/***** First row *****/
|
/***** First row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TH (3,2,"CT",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
||||||
Usr_SEX_UNKNOWN]);
|
Usr_SEX_UNKNOWN]);
|
||||||
HTM_TH (3,1,"LT",Txt_START_END_TIME[Dat_START_TIME]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_START_TIME]);
|
||||||
HTM_TH (3,1,"LT",Txt_START_END_TIME[Dat_END_TIME ]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_END_TIME ]);
|
||||||
HTM_TH (3,1,"LT",Txt_Session);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_Session);
|
||||||
HTM_TH (1,3,"CT LINE_LEFT",Txt_Questions);
|
HTM_TH (1,3,"CT LINE_LEFT",Txt_Questions);
|
||||||
HTM_TH (1,5,"CT LINE_LEFT",Txt_Valid_answers);
|
HTM_TH (1,5,"CT LINE_LEFT",Txt_Valid_answers);
|
||||||
HTM_TH (1,2,"CT LINE_LEFT",Txt_Score);
|
HTM_TH (1,2,"CT LINE_LEFT",Txt_Score);
|
||||||
HTM_TH (3,1,"RT LINE_LEFT",Txt_Grade);
|
HTM_TH (3,1,"RT LINE_BOTTOM LINE_LEFT",Txt_Grade);
|
||||||
HTM_TH (3,1,"LINE_LEFT",NULL);
|
HTM_TH (3,1,"LINE_BOTTOM LINE_LEFT",NULL);
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Second row *****/
|
/***** Second row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TH (2,1,"RT LINE_LEFT",Txt_total);
|
HTM_TH (2,1,"RT LINE_BOTTOM LINE_LEFT",Txt_total);
|
||||||
HTM_TH (2,1,"RT",Txt_QUESTIONS_valid);
|
HTM_TH (2,1,"RT LINE_BOTTOM",Txt_QUESTIONS_valid);
|
||||||
HTM_TH (2,1,"RT",Txt_QUESTIONS_invalid);
|
HTM_TH (2,1,"RT LINE_BOTTOM",Txt_QUESTIONS_invalid);
|
||||||
HTM_TH (1,1,"RT LINE_LEFT",Txt_ANSWERS_correct);
|
HTM_TH (1,1,"RT LINE_LEFT",Txt_ANSWERS_correct);
|
||||||
HTM_TH (1,3,"CT",Txt_ANSWERS_wrong);
|
HTM_TH (1,3,"CT",Txt_ANSWERS_wrong);
|
||||||
HTM_TH (1,1,"RT",Txt_ANSWERS_blank);
|
HTM_TH (1,1,"RT",Txt_ANSWERS_blank);
|
||||||
|
@ -746,13 +746,13 @@ static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther)
|
||||||
/***** Third row *****/
|
/***** Third row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TH (1,1,"RT LINE_LEFT","<em>p<sub>i</sub></em>=1");
|
HTM_TH (1,1,"RT LINE_BOTTOM LINE_LEFT","<em>p<sub>i</sub></em>=1");
|
||||||
HTM_TH (1,1,"RT","-1≤<em>p<sub>i</sub></em><0");
|
HTM_TH (1,1,"RT LINE_BOTTOM","-1≤<em>p<sub>i</sub></em><0");
|
||||||
HTM_TH (1,1,"RT","<em>p<sub>i</sub></em>=0");
|
HTM_TH (1,1,"RT LINE_BOTTOM","<em>p<sub>i</sub></em>=0");
|
||||||
HTM_TH (1,1,"RT","0<<em>p<sub>i</sub></em><1");
|
HTM_TH (1,1,"RT LINE_BOTTOM","0<<em>p<sub>i</sub></em><1");
|
||||||
HTM_TH (1,1,"RT","<em>p<sub>i</sub></em>=0");
|
HTM_TH (1,1,"RT LINE_BOTTOM","<em>p<sub>i</sub></em>=0");
|
||||||
HTM_TH (1,1,"RT LINE_LEFT","<em>Σp<sub>i</sub></em>");
|
HTM_TH (1,1,"RT LINE_BOTTOM LINE_LEFT","<em>Σp<sub>i</sub></em>");
|
||||||
HTM_TH (1,1,"RT","-1≤<em style=\"text-decoration:overline;\">p</em>≤1");
|
HTM_TH (1,1,"RT LINE_BOTTOM","-1≤<em style=\"text-decoration:overline;\">p</em>≤1");
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -998,6 +998,7 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams,
|
||||||
HTM_Txt (Session.Title);
|
HTM_Txt (Session.Title);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Get and accumulate questions and score */
|
||||||
if (ICanView.Score)
|
if (ICanView.Score)
|
||||||
{
|
{
|
||||||
/* Get questions and user's answers of exam print from database */
|
/* Get questions and user's answers of exam print from database */
|
||||||
|
@ -1012,7 +1013,7 @@ static void ExaRes_ShowResults (struct Exa_Exams *Exams,
|
||||||
NumTotalQsts.Valid.Wrong.Positive += Print.NumQsts.Valid.Wrong.Positive;
|
NumTotalQsts.Valid.Wrong.Positive += Print.NumQsts.Valid.Wrong.Positive;
|
||||||
NumTotalQsts.Valid.Blank += Print.NumQsts.Valid.Blank;
|
NumTotalQsts.Valid.Blank += Print.NumQsts.Valid.Blank;
|
||||||
NumTotalQsts.Valid.Total += Print.NumQsts.Valid.Total;
|
NumTotalQsts.Valid.Total += Print.NumQsts.Valid.Total;
|
||||||
TotalScore.Valid += Print.Score.Valid;
|
TotalScore.Valid += Print.Score.Valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write total number of questions */
|
/* Write total number of questions */
|
||||||
|
|
34
swad_match.c
34
swad_match.c
|
@ -4043,21 +4043,21 @@ void Mch_GetMatchQuestionsFromDB (long MchCod,long UsrCod,
|
||||||
struct Mch_UsrAnswer UsrAnswer;
|
struct Mch_UsrAnswer UsrAnswer;
|
||||||
|
|
||||||
/***** Get questions and answers of a match result *****/
|
/***** Get questions and answers of a match result *****/
|
||||||
Print->NumQsts = (unsigned)
|
Print->NumQsts.All = (unsigned)
|
||||||
DB_QuerySELECT (&mysql_res,"can not get questions and answers"
|
DB_QuerySELECT (&mysql_res,"can not get questions and answers"
|
||||||
" of a match result",
|
" of a match result",
|
||||||
"SELECT gam_questions.QstCod," // row[0]
|
"SELECT gam_questions.QstCod," // row[0]
|
||||||
"gam_questions.QstInd," // row[1]
|
"gam_questions.QstInd," // row[1]
|
||||||
"mch_indexes.Indexes" // row[2]
|
"mch_indexes.Indexes" // row[2]
|
||||||
" FROM mch_matches,gam_questions,mch_indexes"
|
" FROM mch_matches,gam_questions,mch_indexes"
|
||||||
" WHERE mch_matches.MchCod=%ld"
|
" WHERE mch_matches.MchCod=%ld"
|
||||||
" AND mch_matches.GamCod=gam_questions.GamCod"
|
" AND mch_matches.GamCod=gam_questions.GamCod"
|
||||||
" AND mch_matches.MchCod=mch_indexes.MchCod"
|
" AND mch_matches.MchCod=mch_indexes.MchCod"
|
||||||
" AND gam_questions.QstInd=mch_indexes.QstInd"
|
" AND gam_questions.QstInd=mch_indexes.QstInd"
|
||||||
" ORDER BY gam_questions.QstInd",
|
" ORDER BY gam_questions.QstInd",
|
||||||
MchCod);
|
MchCod);
|
||||||
for (NumQst = 0, Print->NumQstsNotBlank = 0;
|
for (NumQst = 0, Print->NumQsts.NotBlank = 0;
|
||||||
NumQst < Print->NumQsts;
|
NumQst < Print->NumQsts.All;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
{
|
{
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
@ -4081,7 +4081,7 @@ void Mch_GetMatchQuestionsFromDB (long MchCod,long UsrCod,
|
||||||
{
|
{
|
||||||
snprintf (Print->PrintedQuestions[NumQst].StrAnswers,Tst_MAX_BYTES_ANSWERS_ONE_QST + 1,
|
snprintf (Print->PrintedQuestions[NumQst].StrAnswers,Tst_MAX_BYTES_ANSWERS_ONE_QST + 1,
|
||||||
"%d",UsrAnswer.AnsInd);
|
"%d",UsrAnswer.AnsInd);
|
||||||
Print->NumQstsNotBlank++;
|
Print->NumQsts.NotBlank++;
|
||||||
}
|
}
|
||||||
else // UsrAnswer.AnsInd < 0 ==> no answer selected
|
else // UsrAnswer.AnsInd < 0 ==> no answer selected
|
||||||
Print->PrintedQuestions[NumQst].StrAnswers[0] = '\0'; // Empty answer
|
Print->PrintedQuestions[NumQst].StrAnswers[0] = '\0'; // Empty answer
|
||||||
|
@ -4101,7 +4101,7 @@ void Mch_ComputeScore (struct TstPrn_Print *Print)
|
||||||
struct Tst_Question Question;
|
struct Tst_Question Question;
|
||||||
|
|
||||||
for (NumQst = 0, Print->Score = 0.0;
|
for (NumQst = 0, Print->Score = 0.0;
|
||||||
NumQst < Print->NumQsts;
|
NumQst < Print->NumQsts.All;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
{
|
{
|
||||||
/***** Create test question *****/
|
/***** Create test question *****/
|
||||||
|
|
|
@ -152,8 +152,8 @@ static void MchRes_UpdateMyMatchResult (long MchCod,const struct TstPrn_Print *P
|
||||||
"NumQstsNotBlank=%u,"
|
"NumQstsNotBlank=%u,"
|
||||||
"Score='%.15lg'"
|
"Score='%.15lg'"
|
||||||
" WHERE MchCod=%ld AND UsrCod=%ld",
|
" WHERE MchCod=%ld AND UsrCod=%ld",
|
||||||
Print->NumQsts,
|
Print->NumQsts.All,
|
||||||
Print->NumQstsNotBlank,
|
Print->NumQsts.NotBlank,
|
||||||
Print->Score,
|
Print->Score,
|
||||||
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
else // Match print doesn't exist
|
else // Match print doesn't exist
|
||||||
|
@ -170,8 +170,8 @@ static void MchRes_UpdateMyMatchResult (long MchCod,const struct TstPrn_Print *P
|
||||||
"%u," // NumQstsNotBlank
|
"%u," // NumQstsNotBlank
|
||||||
"'%.15lg')", // Score
|
"'%.15lg')", // Score
|
||||||
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Print->NumQsts,
|
Print->NumQsts.All,
|
||||||
Print->NumQstsNotBlank,
|
Print->NumQsts.NotBlank,
|
||||||
Print->Score);
|
Print->Score);
|
||||||
Str_SetDecimalPointToLocal (); // Return to local system
|
Str_SetDecimalPointToLocal (); // Return to local system
|
||||||
}
|
}
|
||||||
|
@ -1284,7 +1284,7 @@ void MchRes_ShowOneMchResult (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
HTM_Unsigned (Print.NumQsts);
|
HTM_Unsigned (Print.NumQsts.All);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -1297,7 +1297,7 @@ void MchRes_ShowOneMchResult (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
HTM_Unsigned (Print.NumQstsNotBlank);
|
HTM_Unsigned (Print.NumQsts.NotBlank);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -1315,7 +1315,7 @@ void MchRes_ShowOneMchResult (void)
|
||||||
HTM_STRONG_Begin ();
|
HTM_STRONG_Begin ();
|
||||||
HTM_Double2Decimals (Print.Score);
|
HTM_Double2Decimals (Print.Score);
|
||||||
HTM_Txt ("/");
|
HTM_Txt ("/");
|
||||||
HTM_Unsigned (Print.NumQsts);
|
HTM_Unsigned (Print.NumQsts.All);
|
||||||
HTM_STRONG_End ();
|
HTM_STRONG_End ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1335,7 +1335,7 @@ void MchRes_ShowOneMchResult (void)
|
||||||
if (ICanView.Score)
|
if (ICanView.Score)
|
||||||
{
|
{
|
||||||
HTM_STRONG_Begin ();
|
HTM_STRONG_Begin ();
|
||||||
TstPrn_ComputeAndShowGrade (Print.NumQsts,Print.Score,Game.MaxGrade);
|
TstPrn_ComputeAndShowGrade (Print.NumQsts.All,Print.Score,Game.MaxGrade);
|
||||||
HTM_STRONG_End ();
|
HTM_STRONG_End ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1407,12 +1407,12 @@ static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
||||||
Print->TimeUTC[StartEndTime] = Dat_GetUNIXTimeFromStr (row[StartEndTime]);
|
Print->TimeUTC[StartEndTime] = Dat_GetUNIXTimeFromStr (row[StartEndTime]);
|
||||||
|
|
||||||
/* Get number of questions (row[2]) */
|
/* Get number of questions (row[2]) */
|
||||||
if (sscanf (row[2],"%u",&Print->NumQsts) != 1)
|
if (sscanf (row[2],"%u",&Print->NumQsts.All) != 1)
|
||||||
Print->NumQsts = 0;
|
Print->NumQsts.All = 0;
|
||||||
|
|
||||||
/* Get number of questions not blank (row[3]) */
|
/* Get number of questions not blank (row[3]) */
|
||||||
if (sscanf (row[3],"%u",&Print->NumQstsNotBlank) != 1)
|
if (sscanf (row[3],"%u",&Print->NumQsts.NotBlank) != 1)
|
||||||
Print->NumQstsNotBlank = 0;
|
Print->NumQsts.NotBlank = 0;
|
||||||
|
|
||||||
/* Get score (row[4]) */
|
/* Get score (row[4]) */
|
||||||
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
||||||
|
@ -1422,8 +1422,8 @@ static void MchRes_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Print->NumQsts = 0;
|
Print->NumQsts.All =
|
||||||
Print->NumQstsNotBlank = 0;
|
Print->NumQsts.NotBlank = 0;
|
||||||
Print->Score = 0.0;
|
Print->Score = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
swad_test.c
16
swad_test.c
|
@ -387,7 +387,7 @@ void Tst_ShowNewTest (void)
|
||||||
/***** Get questions *****/
|
/***** Get questions *****/
|
||||||
TstPrn_ResetPrint (&Print);
|
TstPrn_ResetPrint (&Print);
|
||||||
Tst_GetQuestionsForNewTestFromDB (&Test,&Print);
|
Tst_GetQuestionsForNewTestFromDB (&Test,&Print);
|
||||||
if (Print.NumQsts)
|
if (Print.NumQsts.All)
|
||||||
{
|
{
|
||||||
/***** Increase number of exams generated (answered or not) by me *****/
|
/***** Increase number of exams generated (answered or not) by me *****/
|
||||||
Tst_IncreaseMyNumAccessTst ();
|
Tst_IncreaseMyNumAccessTst ();
|
||||||
|
@ -550,7 +550,7 @@ void Tst_AssessTest (void)
|
||||||
HTM_Double2Decimals (Print.Score);
|
HTM_Double2Decimals (Print.Score);
|
||||||
HTM_BR ();
|
HTM_BR ();
|
||||||
HTM_TxtColonNBSP (Txt_Grade);
|
HTM_TxtColonNBSP (Txt_Grade);
|
||||||
TstPrn_ComputeAndShowGrade (Print.NumQsts,Print.Score,Tst_SCORE_MAX);
|
TstPrn_ComputeAndShowGrade (Print.NumQsts.All,Print.Score,Tst_SCORE_MAX);
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ static void TstPrn_GetAnswersFromForm (struct TstPrn_Print *Print)
|
||||||
|
|
||||||
/***** Loop for every question getting user's answers *****/
|
/***** Loop for every question getting user's answers *****/
|
||||||
for (NumQst = 0;
|
for (NumQst = 0;
|
||||||
NumQst < Print->NumQsts;
|
NumQst < Print->NumQsts.All;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
{
|
{
|
||||||
/* Get answers selected by user for this question */
|
/* Get answers selected by user for this question */
|
||||||
|
@ -2009,14 +2009,14 @@ static void Tst_GetQuestionsForNewTestFromDB (struct Tst_Test *Test,
|
||||||
Lay_ShowAlert (Lay_INFO,Query);
|
Lay_ShowAlert (Lay_INFO,Query);
|
||||||
*/
|
*/
|
||||||
/* Make the query */
|
/* Make the query */
|
||||||
Print->NumQsts =
|
Print->NumQsts.All =
|
||||||
Test->NumQsts = (unsigned) DB_QuerySELECT (&mysql_res,"can not get questions",
|
Test->NumQsts = (unsigned) DB_QuerySELECT (&mysql_res,"can not get questions",
|
||||||
"%s",
|
"%s",
|
||||||
Query);
|
Query);
|
||||||
|
|
||||||
/***** Get questions and answers from database *****/
|
/***** Get questions and answers from database *****/
|
||||||
for (NumQst = 0;
|
for (NumQst = 0;
|
||||||
NumQst < Print->NumQsts;
|
NumQst < Print->NumQsts.All;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
{
|
{
|
||||||
/* Get question row */
|
/* Get question row */
|
||||||
|
|
|
@ -174,9 +174,8 @@ static void TstPrn_ShowHeaderPrints (void);
|
||||||
static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat);
|
static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat);
|
||||||
static void TstPrn_ShowPrintsSummaryRow (bool ItsMe,
|
static void TstPrn_ShowPrintsSummaryRow (bool ItsMe,
|
||||||
unsigned NumPrints,
|
unsigned NumPrints,
|
||||||
unsigned NumTotalQsts,
|
struct TstPrn_NumQuestions *NumTotalQsts,
|
||||||
unsigned NumTotalQstsNotBlank,
|
double TotalScore);
|
||||||
double TotalScoreOfAllTests);
|
|
||||||
|
|
||||||
static void TstRes_CheckIfICanSeePrintResult (const struct TstPrn_Print *Print,
|
static void TstRes_CheckIfICanSeePrintResult (const struct TstPrn_Print *Print,
|
||||||
long UsrCod,
|
long UsrCod,
|
||||||
|
@ -198,11 +197,11 @@ static void TstPrn_ResetPrintExceptPrnCod (struct TstPrn_Print *Print)
|
||||||
{
|
{
|
||||||
Print->TimeUTC[Dat_START_TIME] =
|
Print->TimeUTC[Dat_START_TIME] =
|
||||||
Print->TimeUTC[Dat_END_TIME ] = (time_t) 0;
|
Print->TimeUTC[Dat_END_TIME ] = (time_t) 0;
|
||||||
Print->NumQsts = 0;
|
Print->NumQsts.All =
|
||||||
Print->NumQstsNotBlank = 0;
|
Print->NumQsts.NotBlank = 0;
|
||||||
Print->Sent = false; // After creating an exam, it's not sent
|
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
|
Print->AllowTeachers = false; // Teachers can't seen the exam if student don't allow it
|
||||||
Print->Score = 0.0;
|
Print->Score = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -220,7 +219,7 @@ void TstPrn_CreatePrintInDB (struct TstPrn_Print *Print)
|
||||||
" (%ld,%ld,NOW(),NOW(),%u,0,'N','N',0)",
|
" (%ld,%ld,NOW(),NOW(),%u,0,'N','N',0)",
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Print->NumQsts);
|
Print->NumQsts.All);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -240,7 +239,7 @@ void TstPrn_UpdatePrintInDB (const struct TstPrn_Print *Print)
|
||||||
"Score='%.15lg'"
|
"Score='%.15lg'"
|
||||||
" WHERE ExaCod=%ld"
|
" WHERE ExaCod=%ld"
|
||||||
" AND CrsCod=%ld AND UsrCod=%ld", // Extra checks
|
" AND CrsCod=%ld AND UsrCod=%ld", // Extra checks
|
||||||
Print->NumQstsNotBlank,
|
Print->NumQsts.NotBlank,
|
||||||
Print->Sent ? 'Y' :
|
Print->Sent ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Print->AllowTeachers ? 'Y' :
|
Print->AllowTeachers ? 'Y' :
|
||||||
|
@ -281,7 +280,7 @@ void TstPrn_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
|
||||||
Gbl.Hierarchy.Deg.DegCod,
|
Gbl.Hierarchy.Deg.DegCod,
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
|
||||||
if (Print->NumQsts)
|
if (Print->NumQsts.All)
|
||||||
{
|
{
|
||||||
/***** Begin form *****/
|
/***** Begin form *****/
|
||||||
Frm_StartForm (Action[RequestOrConfirm]);
|
Frm_StartForm (Action[RequestOrConfirm]);
|
||||||
|
@ -293,7 +292,7 @@ void TstPrn_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
|
||||||
|
|
||||||
/***** Write one row for each question *****/
|
/***** Write one row for each question *****/
|
||||||
for (NumQst = 0;
|
for (NumQst = 0;
|
||||||
NumQst < Print->NumQsts;
|
NumQst < Print->NumQsts.All;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
{
|
{
|
||||||
Gbl.RowEvenOdd = NumQst % 2;
|
Gbl.RowEvenOdd = NumQst % 2;
|
||||||
|
@ -600,11 +599,11 @@ void TstPrn_ShowPrintAfterAssess (struct TstPrn_Print *Print)
|
||||||
HTM_TABLE_BeginWideMarginPadding (10);
|
HTM_TABLE_BeginWideMarginPadding (10);
|
||||||
|
|
||||||
/***** Initialize score and number of questions not blank *****/
|
/***** Initialize score and number of questions not blank *****/
|
||||||
Print->NumQstsNotBlank = 0;
|
Print->NumQsts.NotBlank = 0;
|
||||||
Print->Score = 0.0;
|
Print->Score = 0.0;
|
||||||
|
|
||||||
for (NumQst = 0;
|
for (NumQst = 0;
|
||||||
NumQst < Print->NumQsts;
|
NumQst < Print->NumQsts.All;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
{
|
{
|
||||||
Gbl.RowEvenOdd = NumQst % 2;
|
Gbl.RowEvenOdd = NumQst % 2;
|
||||||
|
@ -627,7 +626,7 @@ void TstPrn_ShowPrintAfterAssess (struct TstPrn_Print *Print)
|
||||||
/***** Compute total score *****/
|
/***** Compute total score *****/
|
||||||
Print->Score += Print->PrintedQuestions[NumQst].Score;
|
Print->Score += Print->PrintedQuestions[NumQst].Score;
|
||||||
if (Print->PrintedQuestions[NumQst].StrAnswers[0]) // User's answer is not blank
|
if (Print->PrintedQuestions[NumQst].StrAnswers[0]) // User's answer is not blank
|
||||||
Print->NumQstsNotBlank++;
|
Print->NumQsts.NotBlank++;
|
||||||
|
|
||||||
/***** Update the number of accesses and the score of this question *****/
|
/***** Update the number of accesses and the score of this question *****/
|
||||||
if (Gbl.Usrs.Me.Role.Logged == Rol_STD)
|
if (Gbl.Usrs.Me.Role.Logged == Rol_STD)
|
||||||
|
@ -767,11 +766,11 @@ void TstPrn_ComputeScoresAndStoreQuestionsOfPrint (struct TstPrn_Print *Print,
|
||||||
|
|
||||||
/***** Initialize total score *****/
|
/***** Initialize total score *****/
|
||||||
Print->Score = 0.0;
|
Print->Score = 0.0;
|
||||||
Print->NumQstsNotBlank = 0;
|
Print->NumQsts.NotBlank = 0;
|
||||||
|
|
||||||
/***** Compute and store scores of all questions *****/
|
/***** Compute and store scores of all questions *****/
|
||||||
for (NumQst = 0;
|
for (NumQst = 0;
|
||||||
NumQst < Print->NumQsts;
|
NumQst < Print->NumQsts.All;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
{
|
{
|
||||||
/* Compute question score */
|
/* Compute question score */
|
||||||
|
@ -788,7 +787,7 @@ void TstPrn_ComputeScoresAndStoreQuestionsOfPrint (struct TstPrn_Print *Print,
|
||||||
/* Accumulate total score */
|
/* Accumulate total score */
|
||||||
Print->Score += Print->PrintedQuestions[NumQst].Score;
|
Print->Score += Print->PrintedQuestions[NumQst].Score;
|
||||||
if (Print->PrintedQuestions[NumQst].StrAnswers[0]) // User's answer is not blank
|
if (Print->PrintedQuestions[NumQst].StrAnswers[0]) // User's answer is not blank
|
||||||
Print->NumQstsNotBlank++;
|
Print->NumQsts.NotBlank++;
|
||||||
|
|
||||||
/* Update the number of hits and the score of this question in tests database */
|
/* Update the number of hits and the score of this question in tests database */
|
||||||
if (UpdateQstScore)
|
if (UpdateQstScore)
|
||||||
|
@ -2009,14 +2008,14 @@ static void TstPrn_ShowHeaderPrints (void)
|
||||||
/***** First row *****/
|
/***** First row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TH (3,2,"CT",Txt_User[Usr_SEX_UNKNOWN]);
|
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[Usr_SEX_UNKNOWN]);
|
||||||
HTM_TH (3,1,"LT",Txt_START_END_TIME[Dat_START_TIME]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_START_TIME]);
|
||||||
HTM_TH (3,1,"LT",Txt_START_END_TIME[Dat_END_TIME ]);
|
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_END_TIME ]);
|
||||||
HTM_TH (3,1,"RT LINE_LEFT",Txt_Questions);
|
HTM_TH (3,1,"RT LINE_BOTTOM LINE_LEFT",Txt_Questions);
|
||||||
HTM_TH (1,2,"CT LINE_LEFT",Txt_Answers);
|
HTM_TH (1,2,"CT LINE_LEFT",Txt_Answers);
|
||||||
HTM_TH (1,2,"CT LINE_LEFT",Txt_Score);
|
HTM_TH (1,2,"CT LINE_LEFT",Txt_Score);
|
||||||
HTM_TH (3,1,"RT LINE_LEFT",Txt_Grade);
|
HTM_TH (3,1,"RT LINE_BOTTOM LINE_LEFT",Txt_Grade);
|
||||||
HTM_TH (3,1,"LINE_LEFT",NULL);
|
HTM_TH (3,1,"LINE_BOTTOM LINE_LEFT",NULL);
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
@ -2033,10 +2032,10 @@ static void TstPrn_ShowHeaderPrints (void)
|
||||||
/***** Third row *****/
|
/***** Third row *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TH (1,1,"RT LINE_LEFT","-1≤<em>p<sub>i</sub></em>≤1");
|
HTM_TH (1,1,"RT LINE_BOTTOM LINE_LEFT","-1≤<em>p<sub>i</sub></em>≤1");
|
||||||
HTM_TH (1,1,"RT","<em>p<sub>i</sub></em>=0");
|
HTM_TH (1,1,"RT LINE_BOTTOM","<em>p<sub>i</sub></em>=0");
|
||||||
HTM_TH (1,1,"RT LINE_LEFT","<em>Σp<sub>i</sub></em>");
|
HTM_TH (1,1,"RT LINE_BOTTOM LINE_LEFT","<em>Σp<sub>i</sub></em>");
|
||||||
HTM_TH (1,1,"RT","-1≤<em style=\"text-decoration:overline;\">p</em>≤1");
|
HTM_TH (1,1,"RT LINE_BOTTOM","-1≤<em style=\"text-decoration:overline;\">p</em>≤1");
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
@ -2056,14 +2055,22 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
Dat_StartEndTime_t StartEndTime;
|
Dat_StartEndTime_t StartEndTime;
|
||||||
char *Id;
|
char *Id;
|
||||||
struct TstPrn_Print Print;
|
struct TstPrn_Print Print;
|
||||||
unsigned NumTotalQsts = 0;
|
unsigned NumQstsBlank;
|
||||||
unsigned NumTotalQstsNotBlank = 0;
|
struct TstPrn_NumQuestions NumTotalQsts;
|
||||||
double TotalScoreOfAllTests = 0.0;
|
double TotalScore;
|
||||||
unsigned NumPrintsVisibleByTchs = 0;
|
unsigned NumPrintsVisibleByTchs = 0;
|
||||||
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||||
struct TstRes_ICanView ICanView;
|
struct TstRes_ICanView ICanView;
|
||||||
char *ClassDat;
|
char *ClassDat;
|
||||||
|
|
||||||
|
/***** Reset print *****/
|
||||||
|
TstPrn_ResetPrint (&Print);
|
||||||
|
|
||||||
|
/***** Reset total number of questions and total score *****/
|
||||||
|
NumTotalQsts.All =
|
||||||
|
NumTotalQsts.NotBlank = 0;
|
||||||
|
TotalScore = 0.0;
|
||||||
|
|
||||||
/***** Make database query *****/
|
/***** Make database query *****/
|
||||||
/* From here... ...to here
|
/* From here... ...to here
|
||||||
___________|_____ _____|___________
|
___________|_____ _____|___________
|
||||||
|
@ -2129,10 +2136,20 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
free (Id);
|
free (Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Accumulate questions and score */
|
||||||
|
if (ICanView.Score)
|
||||||
|
{
|
||||||
|
NumTotalQsts.All += Print.NumQsts.All;
|
||||||
|
NumTotalQsts.NotBlank += Print.NumQsts.NotBlank;
|
||||||
|
TotalScore += Print.Score;
|
||||||
|
}
|
||||||
|
|
||||||
/* Write number of questions */
|
/* Write number of questions */
|
||||||
HTM_TD_Begin ("class=\"%s LINE_LEFT RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"%s LINE_LEFT RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
||||||
if (ICanView.Result)
|
if (ICanView.Result)
|
||||||
HTM_Unsigned (Print.NumQsts);
|
{
|
||||||
|
HTM_Unsigned (Print.NumQsts.All);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -2140,7 +2157,12 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
/* Write number of non-blank answers */
|
/* Write number of non-blank answers */
|
||||||
HTM_TD_Begin ("class=\"%s LINE_LEFT RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"%s LINE_LEFT RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
||||||
if (ICanView.Result)
|
if (ICanView.Result)
|
||||||
HTM_Unsigned (Print.NumQstsNotBlank);
|
{
|
||||||
|
if (Print.NumQsts.NotBlank)
|
||||||
|
HTM_Unsigned (Print.NumQsts.NotBlank);
|
||||||
|
else
|
||||||
|
HTM_Light0 ();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -2148,7 +2170,13 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
/* Write number of blank answers */
|
/* Write number of blank answers */
|
||||||
HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
||||||
if (ICanView.Result)
|
if (ICanView.Result)
|
||||||
HTM_Unsigned (Print.NumQsts - Print.NumQstsNotBlank);
|
{
|
||||||
|
NumQstsBlank = Print.NumQsts.All - Print.NumQsts.NotBlank;
|
||||||
|
if (NumQstsBlank)
|
||||||
|
HTM_Unsigned (NumQstsBlank);
|
||||||
|
else
|
||||||
|
HTM_Light0 ();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -2159,7 +2187,7 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
{
|
{
|
||||||
HTM_Double2Decimals (Print.Score);
|
HTM_Double2Decimals (Print.Score);
|
||||||
HTM_Txt ("/");
|
HTM_Txt ("/");
|
||||||
HTM_Unsigned (Print.NumQsts);
|
HTM_Unsigned (Print.NumQsts.All);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
|
@ -2168,9 +2196,9 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
/* Write average score per question */
|
/* Write average score per question */
|
||||||
HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"%s RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
||||||
if (ICanView.Score)
|
if (ICanView.Score)
|
||||||
HTM_Double2Decimals (Print.NumQsts ? Print.Score /
|
HTM_Double2Decimals (Print.NumQsts.All ? Print.Score /
|
||||||
(double) Print.NumQsts :
|
(double) Print.NumQsts.All :
|
||||||
0.0);
|
0.0);
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -2178,7 +2206,7 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
/* Write grade */
|
/* Write grade */
|
||||||
HTM_TD_Begin ("class=\"%s LINE_LEFT RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"%s LINE_LEFT RT COLOR%u\"",ClassDat,Gbl.RowEvenOdd);
|
||||||
if (ICanView.Score)
|
if (ICanView.Score)
|
||||||
TstPrn_ComputeAndShowGrade (Print.NumQsts,Print.Score,Tst_SCORE_MAX);
|
TstPrn_ComputeAndShowGrade (Print.NumQsts.All,Print.Score,Tst_SCORE_MAX);
|
||||||
else
|
else
|
||||||
Ico_PutIconNotVisible ();
|
Ico_PutIconNotVisible ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -2204,12 +2232,34 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat)
|
||||||
|
|
||||||
/***** Write totals for this user *****/
|
/***** Write totals for this user *****/
|
||||||
TstPrn_ShowPrintsSummaryRow (ItsMe,NumPrintsVisibleByTchs,
|
TstPrn_ShowPrintsSummaryRow (ItsMe,NumPrintsVisibleByTchs,
|
||||||
NumTotalQsts,NumTotalQstsNotBlank,
|
&NumTotalQsts,TotalScore);
|
||||||
TotalScoreOfAllTests);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HTM_TD_ColouredEmpty (8);
|
/* Columns for dates */
|
||||||
|
HTM_TD_Begin ("colspan=\"2\" class=\"LINE_BOTTOM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Column for questions */
|
||||||
|
HTM_TD_Begin ("class=\"LINE_BOTTOM LINE_LEFT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Columns for answers */
|
||||||
|
HTM_TD_Begin ("colspan=\"2\" class=\"LINE_BOTTOM LINE_LEFT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Columns for score */
|
||||||
|
HTM_TD_Begin ("colspan=\"2\" class=\"LINE_BOTTOM LINE_LEFT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Column for grade */
|
||||||
|
HTM_TD_Begin ("class=\"LINE_BOTTOM LINE_LEFT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/* Column for link to show the result */
|
||||||
|
HTM_TD_Begin ("class=\"LINE_BOTTOM LINE_LEFT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2243,10 +2293,9 @@ long TstPrn_GetParamPrnCod (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void TstPrn_ShowPrintsSummaryRow (bool ItsMe,
|
static void TstPrn_ShowPrintsSummaryRow (bool ItsMe,
|
||||||
unsigned NumPrints,
|
unsigned NumPrints,
|
||||||
unsigned NumTotalQsts,
|
struct TstPrn_NumQuestions *NumTotalQsts,
|
||||||
unsigned NumTotalQstsNotBlank,
|
double TotalScore)
|
||||||
double TotalScoreOfAllTests)
|
|
||||||
{
|
{
|
||||||
extern const char *Txt_Visible_tests;
|
extern const char *Txt_Visible_tests;
|
||||||
bool ICanViewTotalScore;
|
bool ICanViewTotalScore;
|
||||||
|
@ -2285,42 +2334,42 @@ static void TstPrn_ShowPrintsSummaryRow (bool ItsMe,
|
||||||
/***** Write total number of questions *****/
|
/***** Write total number of questions *****/
|
||||||
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (NumPrints)
|
if (NumPrints)
|
||||||
HTM_Unsigned (NumTotalQsts);
|
HTM_Unsigned (NumTotalQsts->All);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write total number of non-blank answers *****/
|
/***** Write total number of non-blank answers *****/
|
||||||
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (NumPrints)
|
if (NumPrints)
|
||||||
HTM_Unsigned (NumTotalQstsNotBlank);
|
HTM_Unsigned (NumTotalQsts->NotBlank);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write total number of blank answers *****/
|
/***** Write total number of blank answers *****/
|
||||||
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RM COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (NumPrints)
|
if (NumPrints)
|
||||||
HTM_Unsigned (NumTotalQsts - NumTotalQstsNotBlank);
|
HTM_Unsigned (NumTotalQsts->All - NumTotalQsts->NotBlank);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write total score *****/
|
/***** Write total score *****/
|
||||||
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (ICanViewTotalScore)
|
if (ICanViewTotalScore)
|
||||||
{
|
{
|
||||||
HTM_Double2Decimals (TotalScoreOfAllTests);
|
HTM_Double2Decimals (TotalScore);
|
||||||
HTM_Txt ("/");
|
HTM_Txt ("/");
|
||||||
HTM_Unsigned (NumTotalQsts);
|
HTM_Unsigned (NumTotalQsts->All);
|
||||||
}
|
}
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write average score per question *****/
|
/***** Write average score per question *****/
|
||||||
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RM COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (ICanViewTotalScore)
|
if (ICanViewTotalScore)
|
||||||
HTM_Double2Decimals (NumTotalQsts ? TotalScoreOfAllTests / (double) NumTotalQsts :
|
HTM_Double2Decimals (NumTotalQsts->All ? TotalScore / (double) NumTotalQsts->All :
|
||||||
0.0);
|
0.0);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write grade over Tst_SCORE_MAX *****/
|
/***** Write grade over Tst_SCORE_MAX *****/
|
||||||
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LINE_BOTTOM LINE_LEFT RM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (ICanViewTotalScore)
|
if (ICanViewTotalScore)
|
||||||
TstPrn_ComputeAndShowGrade (NumTotalQsts,TotalScoreOfAllTests,Tst_SCORE_MAX);
|
TstPrn_ComputeAndShowGrade (NumTotalQsts->All,TotalScore,Tst_SCORE_MAX);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Last cell *****/
|
/***** Last cell *****/
|
||||||
|
@ -2447,7 +2496,7 @@ void TstPrn_ShowOnePrint (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
HTM_Unsigned (Print.NumQsts);
|
HTM_Unsigned (Print.NumQsts.All);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -2460,7 +2509,7 @@ void TstPrn_ShowOnePrint (void)
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT LB\"");
|
HTM_TD_Begin ("class=\"DAT LB\"");
|
||||||
HTM_Unsigned (Print.NumQstsNotBlank);
|
HTM_Unsigned (Print.NumQsts.NotBlank);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
@ -2478,7 +2527,7 @@ void TstPrn_ShowOnePrint (void)
|
||||||
HTM_STRONG_Begin ();
|
HTM_STRONG_Begin ();
|
||||||
HTM_Double2Decimals (Print.Score);
|
HTM_Double2Decimals (Print.Score);
|
||||||
HTM_Txt ("/");
|
HTM_Txt ("/");
|
||||||
HTM_Unsigned (Print.NumQsts);
|
HTM_Unsigned (Print.NumQsts.All);
|
||||||
HTM_STRONG_End ();
|
HTM_STRONG_End ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2496,7 +2545,7 @@ void TstPrn_ShowOnePrint (void)
|
||||||
if (ICanView.Score)
|
if (ICanView.Score)
|
||||||
{
|
{
|
||||||
HTM_STRONG_Begin ();
|
HTM_STRONG_Begin ();
|
||||||
TstPrn_ComputeAndShowGrade (Print.NumQsts,Print.Score,Tst_SCORE_MAX);
|
TstPrn_ComputeAndShowGrade (Print.NumQsts.All,Print.Score,Tst_SCORE_MAX);
|
||||||
HTM_STRONG_End ();
|
HTM_STRONG_End ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2618,7 +2667,7 @@ void TstPrn_ShowPrintAnswers (struct UsrData *UsrDat,
|
||||||
bool QuestionExists;
|
bool QuestionExists;
|
||||||
|
|
||||||
for (NumQst = 0;
|
for (NumQst = 0;
|
||||||
NumQst < Print->NumQsts;
|
NumQst < Print->NumQsts.All;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
{
|
{
|
||||||
Gbl.RowEvenOdd = NumQst % 2;
|
Gbl.RowEvenOdd = NumQst % 2;
|
||||||
|
@ -2674,12 +2723,12 @@ void TstPrn_GetPrintDataByPrnCod (struct TstPrn_Print *Print)
|
||||||
Print->TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[2]);
|
Print->TimeUTC[Dat_END_TIME ] = Dat_GetUNIXTimeFromStr (row[2]);
|
||||||
|
|
||||||
/* Get number of questions (row[3]) */
|
/* Get number of questions (row[3]) */
|
||||||
if (sscanf (row[3],"%u",&Print->NumQsts) != 1)
|
if (sscanf (row[3],"%u",&Print->NumQsts.All) != 1)
|
||||||
Print->NumQsts = 0;
|
Print->NumQsts.All = 0;
|
||||||
|
|
||||||
/* Get number of questions not blank (row[4]) */
|
/* Get number of questions not blank (row[4]) */
|
||||||
if (sscanf (row[4],"%u",&Print->NumQstsNotBlank) != 1)
|
if (sscanf (row[4],"%u",&Print->NumQsts.NotBlank) != 1)
|
||||||
Print->NumQstsNotBlank = 0;
|
Print->NumQsts.NotBlank = 0;
|
||||||
|
|
||||||
/* Get if exam has been sent (row[5]) */
|
/* Get if exam has been sent (row[5]) */
|
||||||
Print->Sent = (row[5][0] == 'Y');
|
Print->Sent = (row[5][0] == 'Y');
|
||||||
|
@ -2725,7 +2774,7 @@ void TstPrn_GetPrintQuestionsFromDB (struct TstPrn_Print *Print)
|
||||||
Print->PrnCod);
|
Print->PrnCod);
|
||||||
|
|
||||||
/***** Get questions *****/
|
/***** Get questions *****/
|
||||||
if (NumQsts == Print->NumQsts)
|
if (NumQsts == Print->NumQsts.All)
|
||||||
for (NumQst = 0;
|
for (NumQst = 0;
|
||||||
NumQst < NumQsts;
|
NumQst < NumQsts;
|
||||||
NumQst++)
|
NumQst++)
|
||||||
|
@ -2754,7 +2803,7 @@ void TstPrn_GetPrintQuestionsFromDB (struct TstPrn_Print *Print)
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
if (NumQsts != Print->NumQsts)
|
if (NumQsts != Print->NumQsts.All)
|
||||||
Lay_WrongExamExit ();
|
Lay_WrongExamExit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,12 @@
|
||||||
/******************************* Public types ********************************/
|
/******************************* Public types ********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
struct TstPrn_NumQuestions
|
||||||
|
{
|
||||||
|
unsigned All; // Total number of questions
|
||||||
|
unsigned NotBlank; // Answered questions
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TstPrn_ANSWER_IS_CORRECT,
|
TstPrn_ANSWER_IS_CORRECT,
|
||||||
|
@ -63,8 +69,7 @@ struct TstPrn_Print
|
||||||
{
|
{
|
||||||
long PrnCod; // Test print code
|
long PrnCod; // Test print code
|
||||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||||
unsigned NumQsts; // Number of questions
|
struct TstPrn_NumQuestions NumQsts; // Number of questions
|
||||||
unsigned NumQstsNotBlank; // Number of questions not blank
|
|
||||||
bool Sent; // This test print has been sent or not?
|
bool Sent; // This test print has been sent or not?
|
||||||
// "Sent" means that user has clicked "Send" button after finishing
|
// "Sent" means that user has clicked "Send" button after finishing
|
||||||
bool AllowTeachers; // Are teachers allowed to see this test result?
|
bool AllowTeachers; // Are teachers allowed to see this test result?
|
||||||
|
|
|
@ -9974,10 +9974,10 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
|
||||||
|
|
||||||
/***** Show user's photo *****/
|
/***** Show user's photo *****/
|
||||||
if (NumRows)
|
if (NumRows)
|
||||||
HTM_TD_Begin ("rowspan=\"%u\" class=\"LT COLOR%u\"",
|
HTM_TD_Begin ("rowspan=\"%u\" class=\"LT LINE_BOTTOM COLOR%u\"",
|
||||||
NumRows + 1,Gbl.RowEvenOdd);
|
NumRows + 1,Gbl.RowEvenOdd);
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"LT LINE_BOTTOM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
|
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
|
||||||
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
|
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -9987,10 +9987,10 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
|
||||||
/***** User's IDs and name *****/
|
/***** User's IDs and name *****/
|
||||||
/* Begin cell */
|
/* Begin cell */
|
||||||
if (NumRows)
|
if (NumRows)
|
||||||
HTM_TD_Begin ("rowspan=\"%u\" class=\"LT COLOR%u\"",
|
HTM_TD_Begin ("rowspan=\"%u\" class=\"LT LINE_BOTTOM COLOR%u\"",
|
||||||
NumRows + 1,Gbl.RowEvenOdd);
|
NumRows + 1,Gbl.RowEvenOdd);
|
||||||
else
|
else
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"LT LINE_BOTTOM COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
/* Action to go to user's record depending on role in course */
|
/* Action to go to user's record depending on role in course */
|
||||||
switch (UsrDat->Roles.InCurrentCrs.Role)
|
switch (UsrDat->Roles.InCurrentCrs.Role)
|
||||||
|
|
Loading…
Reference in New Issue