Version19.12.6

This commit is contained in:
Antonio Cañas Vargas 2019-09-24 22:48:25 +02:00
parent 0685691fd7
commit 851f558ee8
4 changed files with 76 additions and 17 deletions

View File

@ -470,10 +470,11 @@ 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.12.5 (2019-09-24)" #define Log_PLATFORM_VERSION "SWAD 19.12.6 (2019-09-24)"
#define CSS_FILE "swad19.3.css" #define CSS_FILE "swad19.3.css"
#define JS_FILE "swad18.130.2.js" #define JS_FILE "swad18.130.2.js"
/* /*
Version 19.12.6: Sep 24, 2019 View tag list in a match result. (245974 lines)
Version 19.12.5: Sep 24, 2019 View matches results. (245925 lines) Version 19.12.5: Sep 24, 2019 View matches results. (245925 lines)
Version 19.12.4: Sep 24, 2019 Fixed bug in edition of games. (245963 lines) Version 19.12.4: Sep 24, 2019 Fixed bug in edition of games. (245963 lines)
Version 19.12.3: Sep 24, 2019 View matches results. Not finished. (245979 lines) Version 19.12.3: Sep 24, 2019 View matches results. Not finished. (245979 lines)

View File

@ -222,6 +222,7 @@ static void Mch_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
unsigned *NumQsts, unsigned *NumQsts,
unsigned *NumQstsNotBlank, unsigned *NumQstsNotBlank,
double *Score); double *Score);
static void Mch_ShowTstTagsPresentInAMatchResult (long GamCod);
/*****************************************************************************/ /*****************************************************************************/
/************************* List the matches of a game ************************/ /************************* List the matches of a game ************************/
@ -3254,7 +3255,8 @@ void Mch_ShowOneMchResult (void)
extern const char *Txt_non_blank_QUESTIONS; extern const char *Txt_non_blank_QUESTIONS;
extern const char *Txt_Score; extern const char *Txt_Score;
extern const char *Txt_out_of_PART_OF_A_SCORE; extern const char *Txt_out_of_PART_OF_A_SCORE;
long MchCod; extern const char *Txt_Tags;
struct Match Match;
Usr_MeOrOther_t MeOrOther; Usr_MeOrOther_t MeOrOther;
struct UsrData *UsrDat; struct UsrData *UsrDat;
time_t TimeUTC[Dat_NUM_START_END_TIME]; // Match result UTC date-time time_t TimeUTC[Dat_NUM_START_END_TIME]; // Match result UTC date-time
@ -3268,9 +3270,12 @@ void Mch_ShowOneMchResult (void)
bool ICanViewScore; bool ICanViewScore;
/***** Get match code *****/ /***** Get match code *****/
if ((MchCod = Mch_GetParamMchCod ()) == -1L) if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of match is missing."); Lay_ShowErrorAndExit ("Code of match is missing.");
/***** Get data of the match from database *****/
Mch_GetDataOfMatchByCod (&Match);
/***** Pointer to user's data *****/ /***** Pointer to user's data *****/
MeOrOther = (Gbl.Action.Act == ActSeeOneMchResMe) ? Usr_ME : MeOrOther = (Gbl.Action.Act == ActSeeOneMchResMe) ? Usr_ME :
Usr_OTHER; Usr_OTHER;
@ -3287,7 +3292,7 @@ void Mch_ShowOneMchResult (void)
} }
/***** Get test result data *****/ /***** Get test result data *****/
Mch_GetMatchResultDataByMchCod (MchCod,UsrDat->UsrCod, Mch_GetMatchResultDataByMchCod (Match.MchCod,UsrDat->UsrCod,
TimeUTC, TimeUTC,
&NumQsts, &NumQsts,
&NumQstsNotBlank, &NumQstsNotBlank,
@ -3341,7 +3346,7 @@ void Mch_ShowOneMchResult (void)
if (ICanViewResult) // I am allowed to view this match result if (ICanViewResult) // I am allowed to view this match result
{ {
/***** Get questions and user's answers of the match result from database *****/ /***** Get questions and user's answers of the match result from database *****/
Mch_GetMatchResultQuestionsFromDB (MchCod,UsrDat->UsrCod, Mch_GetMatchResultQuestionsFromDB (Match.MchCod,UsrDat->UsrCod,
&NumQsts,&NumQstsNotBlank); &NumQsts,&NumQstsNotBlank);
/***** Start box *****/ /***** Start box *****/
@ -3446,6 +3451,17 @@ void Mch_ShowOneMchResult (void)
"</tr>", "</tr>",
Txt_out_of_PART_OF_A_SCORE,Tst_SCORE_MAX); Txt_out_of_PART_OF_A_SCORE,Tst_SCORE_MAX);
/* Tags present in this result */
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"DAT_N RIGHT_TOP\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_TOP\">",
Txt_Tags);
Mch_ShowTstTagsPresentInAMatchResult (Match.GamCod);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/***** Write answers and solutions *****/ /***** Write answers and solutions *****/
Tst_ShowTestResult (UsrDat,NumQsts,TimeUTC[Dat_START_TIME]); Tst_ShowTestResult (UsrDat,NumQsts,TimeUTC[Dat_START_TIME]);
@ -3588,3 +3604,32 @@ static void Mch_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
/*****************************************************************************/
/******************** Show test tags in this match result ********************/
/*****************************************************************************/
static void Mch_ShowTstTagsPresentInAMatchResult (long GamCod)
{
MYSQL_RES *mysql_res;
unsigned long NumTags;
/***** Get all tags of questions in this test *****/
NumTags = (unsigned)
DB_QuerySELECT (&mysql_res,"can not get tags"
" present in a match result",
"SELECT tst_tags.TagTxt" // row[0]
" FROM"
" (SELECT DISTINCT(tst_question_tags.TagCod)"
" FROM tst_question_tags,gam_questions"
" WHERE gam_questions.GamCod=%ld"
" AND gam_questions.QstCod=tst_question_tags.QstCod)"
" AS TagsCods,tst_tags"
" WHERE TagsCods.TagCod=tst_tags.TagCod"
" ORDER BY tst_tags.TagTxt",
GamCod);
Tst_ShowTagList (NumTags,mysql_res);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}

View File

@ -872,14 +872,12 @@ static void Tst_ShowTestQuestionsWhenSeeing (MYSQL_RES *mysql_res)
static void Tst_ShowTstTagsPresentInATestResult (long TstCod) static void Tst_ShowTstTagsPresentInATestResult (long TstCod)
{ {
extern const char *Txt_no_tags;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; unsigned long NumTags;
unsigned long NumRows;
unsigned long NumRow;
/***** Get all tags of questions in this test *****/ /***** Get all tags of questions in this test *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get tags" NumTags = (unsigned)
DB_QuerySELECT (&mysql_res,"can not get tags"
" present in a test result", " present in a test result",
"SELECT tst_tags.TagTxt" // row[0] "SELECT tst_tags.TagTxt" // row[0]
" FROM" " FROM"
@ -891,13 +889,29 @@ static void Tst_ShowTstTagsPresentInATestResult (long TstCod)
" WHERE TagsCods.TagCod=tst_tags.TagCod" " WHERE TagsCods.TagCod=tst_tags.TagCod"
" ORDER BY tst_tags.TagTxt", " ORDER BY tst_tags.TagTxt",
TstCod); TstCod);
if (NumRows) Tst_ShowTagList (NumTags,mysql_res);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
/************************** Show list of test tags ***************************/
/*****************************************************************************/
void Tst_ShowTagList (unsigned NumTags,MYSQL_RES *mysql_res)
{
extern const char *Txt_no_tags;
MYSQL_ROW row;
unsigned NumTag;
if (NumTags)
{ {
/***** Write the tags *****/ /***** Write the tags *****/
fprintf (Gbl.F.Out,"<ul>"); fprintf (Gbl.F.Out,"<ul>");
for (NumRow = 0; for (NumTag = 0;
NumRow < NumRows; NumTag < NumTags;
NumRow++) NumTag++)
{ {
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
fprintf (Gbl.F.Out,"<li>%s</li>", fprintf (Gbl.F.Out,"<li>%s</li>",
@ -908,9 +922,6 @@ static void Tst_ShowTstTagsPresentInATestResult (long TstCod)
else else
fprintf (Gbl.F.Out,"%s", fprintf (Gbl.F.Out,"%s",
Txt_no_tags); Txt_no_tags);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -142,6 +142,8 @@ void Tst_ShowNewTest (void);
void Tst_AssessTest (void); void Tst_AssessTest (void);
void Tst_ShowTstTotalMark (unsigned NumQsts,double TotalScore); void Tst_ShowTstTotalMark (unsigned NumQsts,double TotalScore);
void Tst_ShowTagList (unsigned NumTags,MYSQL_RES *mysql_res);
void Tst_WriteQstStem (const char *Stem,const char *ClassStem); void Tst_WriteQstStem (const char *Stem,const char *ClassStem);
void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback); void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback);