Version19.41.2

This commit is contained in:
Antonio Cañas Vargas 2019-10-23 01:30:11 +02:00
parent 5fdecdbed4
commit 5504d27be3
4 changed files with 44 additions and 36 deletions

View File

@ -487,7 +487,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.41 (2019-10-22)"
#define Log_PLATFORM_VERSION "SWAD 19.41.2 (2019-10-23)"
#define CSS_FILE "swad19.40.3.css"
#define JS_FILE "swad19.39.js"
/*
@ -495,6 +495,7 @@ ps2pdf source.ps destination.pdf
// TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.)
// TODO: Change icon to upload file in timeline to photo-video.svg
Version 19.41.2: Oct 23, 2019 Display match answers in columns. (245951 lines)
Version 19.41.1: Oct 22, 2019 Change number of columns from form. (245944 lines)
1 change necessary in database:
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1802','es','N','Cambiar número de columnas en partida');

View File

@ -165,6 +165,8 @@ static void Mch_PutParamNumCols (unsigned NumCols);
static void Mch_ShowMatchTitle (struct Match *Match);
static void Mch_ShowFormViewResult (struct Match *Match);
static void Mch_ShowQuestionAndAnswersTch (struct Match *Match);
static void Mch_WriteAnswersMatchResult (struct Match *Match,
const char *Class,bool ShowResult);
static void Mch_ShowQuestionAndAnswersStd (struct Match *Match);
static void Mch_ShowMatchScore (struct Match *Match);
@ -2497,9 +2499,7 @@ static void Mch_ShowQuestionAndAnswersTch (struct Match *Match)
case Mch_ANSWERS:
if (Match->Status.Playing) // Being played
/* Write answers */
Tst_WriteAnswersMatchResult (Match->MchCod,
Match->Status.QstInd,
Match->Status.QstCod,
Mch_WriteAnswersMatchResult (Match,
"MCH_TCH_ANS",
false); // Don't show result
else // Not being played
@ -2507,9 +2507,7 @@ static void Mch_ShowQuestionAndAnswersTch (struct Match *Match)
break;
case Mch_RESULTS:
/* Write answers with results */
Tst_WriteAnswersMatchResult (Match->MchCod,
Match->Status.QstInd,
Match->Status.QstCod,
Mch_WriteAnswersMatchResult (Match,
"MCH_TCH_ANS",
true); // Show result
break;
@ -2518,6 +2516,21 @@ static void Mch_ShowQuestionAndAnswersTch (struct Match *Match)
fprintf (Gbl.F.Out,"</div>"); // Bottom
}
/*****************************************************************************/
/************* Write answers of a question when viewing a match **************/
/*****************************************************************************/
static void Mch_WriteAnswersMatchResult (struct Match *Match,
const char *Class,bool ShowResult)
{
/***** Write answer depending on type *****/
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE)
Tst_WriteChoiceAnsViewMatch (Match->MchCod,Match->Status.QstInd,Match->Status.QstCod,
Match->Status.NumCols,Class,ShowResult);
else
Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
}
/*****************************************************************************/
/***** Show question and its answers when playing a match (as a student) *****/
/*****************************************************************************/

View File

@ -206,9 +206,6 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
static void Tst_WriteChoiceAnsAssessTest (struct UsrData *UsrDat,
unsigned NumQst,MYSQL_RES *mysql_res,
double *ScoreThisQst,bool *AnswerIsNotBlank);
static void Tst_WriteChoiceAnsViewMatch (long MchCod,unsigned QstInd,long QstCod,
const char *Class,
bool ShowResult);
static void Tst_WriteTextAnsViewTest (unsigned NumQst);
static void Tst_WriteTextAnsAssessTest (struct UsrData *UsrDat,
@ -3520,21 +3517,6 @@ static void Tst_WriteAnswersTestResult (struct UsrData *UsrDat,
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
/************* Write answers of a question when viewing a match **************/
/*****************************************************************************/
void Tst_WriteAnswersMatchResult (long MchCod,unsigned QstInd,long QstCod,
const char *Class,bool ShowResult)
{
/***** Write answer depending on type *****/
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE)
Tst_WriteChoiceAnsViewMatch (MchCod,QstInd,QstCod,
Class,ShowResult);
else
Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
}
/*****************************************************************************/
/***************** Check if a question is valid for a game *******************/
/*****************************************************************************/
@ -4131,11 +4113,11 @@ void Tst_ComputeScoreQst (unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION], // Ind
/******** Write single or multiple choice answer when viewing a match ********/
/*****************************************************************************/
static void Tst_WriteChoiceAnsViewMatch (long MchCod,unsigned QstInd,long QstCod,
const char *Class,
bool ShowResult)
void Tst_WriteChoiceAnsViewMatch (long MchCod,unsigned QstInd,long QstCod,
unsigned NumCols,const char *Class,bool ShowResult)
{
unsigned NumOpt;
bool RowIsOpen = false;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumAnswerersQst;
@ -4190,13 +4172,17 @@ static void Tst_WriteChoiceAnsViewMatch (long MchCod,unsigned QstInd,long QstCod
/***** Begin table *****/
Tbl_TABLE_BeginWidePadding (5);
/***** Show one row for each option *****/
/***** Show options distributed in columns *****/
for (NumOpt = 0;
NumOpt < Gbl.Test.Answer.NumOptions;
NumOpt++)
{
/***** Start row for this option *****/
Tbl_TR_Begin (NULL);
/***** Start row? *****/
if (NumOpt % NumCols == 0)
{
Tbl_TR_Begin (NULL);
RowIsOpen = true;
}
/***** Write letter for this option *****/
Tbl_TD_Begin ("class=\"MCH_TCH_BUTTON_TD\"");
@ -4208,7 +4194,7 @@ static void Tst_WriteChoiceAnsViewMatch (long MchCod,unsigned QstInd,long QstCod
Tbl_TD_End ();
/***** Write the option text and the result *****/
Tbl_TD_Begin ("class=\"LM\"");
Tbl_TD_Begin ("class=\"LT\"");
fprintf (Gbl.F.Out,"<label for=\"Ans%06u_%u\" class=\"%s\">"
"%s"
"</label>",
@ -4229,10 +4215,18 @@ static void Tst_WriteChoiceAnsViewMatch (long MchCod,unsigned QstInd,long QstCod
Tbl_TD_End ();
/***** End row for this option *****/
Tbl_TR_End ();
/***** End row? *****/
if (NumOpt % NumCols == NumCols - 1)
{
Tbl_TR_End ();
RowIsOpen = false;
}
}
/***** End row? *****/
if (RowIsOpen)
Tbl_TR_End ();
/***** End table *****/
Tbl_TABLE_End ();
}

View File

@ -157,8 +157,6 @@ unsigned Tst_GetNumAnswersQst (long QstCod);
unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle);
void Tst_GetCorrectAnswersFromDB (long QstCod);
void Tst_WriteAnswersEdit (long QstCod);
void Tst_WriteAnswersMatchResult (long MchCod,unsigned QstInd,long QstCod,
const char *Class,bool ShowResult);
bool Tst_CheckIfQuestionIsValidForGame (long QstCod);
void Tst_WriteAnsTF (char AnsTF);
void Tst_GetChoiceAns (MYSQL_RES *mysql_res);
@ -169,6 +167,8 @@ void Tst_GetAnswersFromStr (const char StrAnswersOneQst[Tst_MAX_BYTES_ANSWERS_ON
void Tst_ComputeScoreQst (unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION],
bool AnswersUsr[Tst_MAX_OPTIONS_PER_QUESTION],
double *ScoreThisQst,bool *AnswerIsNotBlank);
void Tst_WriteChoiceAnsViewMatch (long MchCod,unsigned QstInd,long QstCod,
unsigned NumCols,const char *Class,bool ShowResult);
void Tst_CheckIfNumberOfAnswersIsOne (void);
unsigned long Tst_GetTagsQst (long QstCod,MYSQL_RES **mysql_res);