Version19.155.4

This commit is contained in:
acanas 2020-03-27 18:56:00 +01:00
parent aabd3033fb
commit cddd615a2d
3 changed files with 23 additions and 23 deletions

View File

@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.155.3 (2020-03-27)"
#define Log_PLATFORM_VERSION "SWAD 19.155.4 (2020-03-27)"
#define CSS_FILE "swad19.146.css"
#define JS_FILE "swad19.153.js"
/*
@ -526,9 +526,10 @@ Param
// TODO: URGENT: Fix bug while playing match.
Version 19.155.4: Mar 26, 2020 Code refactoring in tests. (284476 lines)
Version 19.155.3: Mar 27, 2020 Code refactoring in pass to parameters of functions. (284476 lines)
Version 19.155.2 Mar 26, 2020 Code refactoring in tests. (284414 lines)
Version 19.155.1 Mar 26, 2020 Code refactoring in tests. (284430 lines)
Version 19.155.2: Mar 26, 2020 Code refactoring in tests. (284414 lines)
Version 19.155.1: Mar 26, 2020 Code refactoring in tests. (284430 lines)
Version 19.155: Mar 25, 2020 Big code refactoring in pass to parameters of functions. (284446 lines)
Version 19.154: Mar 25, 2020 Code refactoring in tests. (283385 lines)
Version 19.153: Mar 24, 2020 Code refactoring in tests. (283432 lines)

View File

@ -3277,7 +3277,7 @@ void Tst_GetAnswersQst (struct Tst_Question *Question,MYSQL_RES **mysql_res,
bool Shuffle)
{
/***** Get answers of a question from database *****/
Question->Answer.NumOptions =(unsigned)
Question->Answer.NumOptions = (unsigned)
DB_QuerySELECT (mysql_res,"can not get answers of a question",
"SELECT AnsInd," // row[0]
"Answer," // row[1]

View File

@ -68,7 +68,7 @@ extern struct Globals Gbl;
static void TsI_PutParamsExportQsts (void *TestPtr);
static void TsI_PutCreateXMLParam (void);
static void TsI_ExportQuestion (long QstCod,FILE *FileXML);
static void TsI_ExportQuestion (struct Tst_Question *Question,FILE *FileXML);
static void TsI_GetAndWriteTagsXML (long QstCod,FILE *FileXML);
static void TsI_WriteAnswersOfAQstXML (struct Tst_Question *Question,
@ -192,8 +192,8 @@ void TsI_CreateXML (unsigned NumQsts,MYSQL_RES *mysql_res)
char PathPubFile[PATH_MAX + 1];
FILE *FileXML;
unsigned NumQst;
struct Tst_Question Question;
MYSQL_ROW row;
long QstCod;
/***** Create a temporary public directory
used to download the XML file *****/
@ -217,12 +217,18 @@ void TsI_CreateXML (unsigned NumQsts,MYSQL_RES *mysql_res)
NumQst < NumQsts;
NumQst++)
{
/* Create test question */
Tst_QstConstructor (&Question);
/* Get question code (row[0]) */
row = mysql_fetch_row (mysql_res);
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
Lay_ShowErrorAndExit ("Wrong code of question.");
TsI_ExportQuestion (QstCod,FileXML);
TsI_ExportQuestion (&Question,FileXML);
/* Destroy test question */
Tst_QstDestructor (&Question);
}
/***** End XML file *****/
@ -249,18 +255,14 @@ void TsI_CreateXML (unsigned NumQsts,MYSQL_RES *mysql_res)
/****************** Write one question into the XML file *********************/
/*****************************************************************************/
static void TsI_ExportQuestion (long QstCod,FILE *FileXML)
static void TsI_ExportQuestion (struct Tst_Question *Question,FILE *FileXML)
{
extern const char *Tst_StrAnswerTypesXML[Tst_NUM_ANS_TYPES];
extern const char *Txt_NEW_LINE;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
struct Tst_Question Question;
/***** Create test question *****/
Tst_QstConstructor (&Question);
if (Tst_GetOneQuestionByCod (QstCod,&mysql_res))
if (Tst_GetOneQuestionByCod (Question->QstCod,&mysql_res))
{
/***** Get row *****/
row = mysql_fetch_row (mysql_res);
@ -277,13 +279,13 @@ static void TsI_ExportQuestion (long QstCod,FILE *FileXML)
*/
/***** Write the answer type (row[1]) *****/
Question.Answer.Type = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
Question->Answer.Type = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
fprintf (FileXML,"<question type=\"%s\">%s",
Tst_StrAnswerTypesXML[Question.Answer.Type],Txt_NEW_LINE);
Tst_StrAnswerTypesXML[Question->Answer.Type],Txt_NEW_LINE);
/***** Write the question tags *****/
fprintf (FileXML,"<tags>%s",Txt_NEW_LINE);
TsI_GetAndWriteTagsXML (QstCod,FileXML);
TsI_GetAndWriteTagsXML (Question->QstCod,FileXML);
fprintf (FileXML,"</tags>%s",Txt_NEW_LINE);
/***** Write the stem (row[3]), that is in HTML format *****/
@ -299,22 +301,19 @@ static void TsI_ExportQuestion (long QstCod,FILE *FileXML)
/***** Write the answers of this question.
Shuffle can be enabled or disabled (row[2]) *****/
fprintf (FileXML,"<answer");
if (Question.Answer.Type == Tst_ANS_UNIQUE_CHOICE ||
Question.Answer.Type == Tst_ANS_MULTIPLE_CHOICE)
if (Question->Answer.Type == Tst_ANS_UNIQUE_CHOICE ||
Question->Answer.Type == Tst_ANS_MULTIPLE_CHOICE)
fprintf (FileXML," shuffle=\"%s\"",
(row[2][0] == 'Y') ? "yes" :
"no");
fprintf (FileXML,">");
TsI_WriteAnswersOfAQstXML (&Question,FileXML);
TsI_WriteAnswersOfAQstXML (Question,FileXML);
fprintf (FileXML,"</answer>%s",Txt_NEW_LINE);
/***** End question *****/
fprintf (FileXML,"</question>%s%s",
Txt_NEW_LINE,Txt_NEW_LINE);
}
/***** Destroy test question *****/
Tst_QstDestructor (&Question);
}
/*****************************************************************************/