Version 21.43: Oct 25, 2021 New module swad_question for test/exam/game questions.

This commit is contained in:
acanas 2021-10-25 10:24:43 +02:00
parent b097b0eda9
commit b1854d0dea
14 changed files with 274 additions and 125 deletions

View File

@ -74,7 +74,7 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
swad_place.o swad_place_database.o swad_plugin.o swad_plugin_database.o \
swad_privacy.o swad_profile.o swad_profile_database.o swad_program.o \
swad_program_database.o swad_project.o swad_project_database.o \
swad_question_import.o swad_QR.o \
swad_question.o swad_question_import.o swad_QR.o \
swad_record.o swad_record_database.o swad_report.o \
swad_report_database.o swad_role.o swad_role_database.o swad_room.o \
swad_room_database.o swad_RSS.o \

View File

@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
*/
#define Log_PLATFORM_VERSION "SWAD 21.42.2 (2021-10-25)"
#define Log_PLATFORM_VERSION "SWAD 21.43 (2021-10-25)"
#define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.69.1.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 21.43: Oct 25, 2021 New module swad_question for test/exam/game questions. (320919 lines)
Version 21.42.2: Oct 25, 2021 Code refactoring in test questions. (320795 lines)
Version 21.42.1: Oct 25, 2021 Code refactoring in test questions. (320784 lines)
Version 21.42: Oct 24, 2021 Code refactoring in test questions. (320782 lines)

View File

@ -1307,8 +1307,8 @@ mysql> DESCRIBE exa_set_answers;
DB_CreateTable ("CREATE TABLE IF NOT EXISTS exa_set_answers ("
"QstCod INT NOT NULL,"
"AnsInd TINYINT NOT NULL,"
"Answer TEXT NOT NULL," // Tst_MAX_BYTES_ANSWER_OR_FEEDBACK
"Feedback TEXT NOT NULL," // Tst_MAX_BYTES_ANSWER_OR_FEEDBACK
"Answer TEXT NOT NULL," // Qst_MAX_BYTES_ANSWER_OR_FEEDBACK
"Feedback TEXT NOT NULL," // Qst_MAX_BYTES_ANSWER_OR_FEEDBACK
"MedCod INT NOT NULL DEFAULT -1,"
"Correct ENUM('N','Y') NOT NULL,"
"UNIQUE INDEX(QstCod,AnsInd),"
@ -3101,8 +3101,8 @@ mysql> DESCRIBE tst_answers;
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tst_answers ("
"QstCod INT NOT NULL,"
"AnsInd TINYINT NOT NULL,"
"Answer TEXT NOT NULL," // Tst_MAX_BYTES_ANSWER_OR_FEEDBACK
"Feedback TEXT NOT NULL," // Tst_MAX_BYTES_ANSWER_OR_FEEDBACK
"Answer TEXT NOT NULL," // Qst_MAX_BYTES_ANSWER_OR_FEEDBACK
"Feedback TEXT NOT NULL," // Qst_MAX_BYTES_ANSWER_OR_FEEDBACK
"MedCod INT NOT NULL DEFAULT -1,"
"Correct ENUM('N','Y') NOT NULL,"
"INDEX(QstCod),"

View File

@ -1312,7 +1312,7 @@ static void ExaPrn_GetCorrectTxtAnswerFromDB (struct Qst_Question *Question)
/***** Copy answer text (row[0]) ******/
Str_Copy (Question->Answer.Options[NumOpt].Text,row[0],
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
}
/***** Change format of answers text *****/

View File

@ -1151,14 +1151,14 @@ void ExaSet_GetQstDataFromDB (struct Qst_Question *Question)
if (row[1])
if (row[1][0])
Str_Copy (Question->Answer.Options[NumOpt].Text ,row[1],
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
/* Get feedback (row[2]) */
Question->Answer.Options[NumOpt].Feedback[0] = '\0';
if (row[2])
if (row[2][0])
Str_Copy (Question->Answer.Options[NumOpt].Feedback,row[2],
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
/* Get media (row[3]) */
Question->Answer.Options[NumOpt].Media.MedCod = Str_ConvertStrCodToLongCod (row[3]);

View File

@ -29,6 +29,7 @@
/*****************************************************************************/
#include "swad_exam_type.h"
#include "swad_question.h"
#include "swad_question_type.h"
/*****************************************************************************/

125
swad_question.c Normal file
View File

@ -0,0 +1,125 @@
// swad_question.c: test/exam/game questions
/*
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2021 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/*********************************** Headers *********************************/
/*****************************************************************************/
// #define _GNU_SOURCE // For asprintf
// #include <limits.h> // For UINT_MAX
// #include <linux/limits.h> // For PATH_MAX
// #include <mysql/mysql.h> // To access MySQL databases
// #include <stdbool.h> // For boolean type
// #include <stddef.h> // For NULL
// #include <stdio.h> // For asprintf
// #include <stdlib.h> // For exit, system, malloc, free, etc
// #include <string.h> // For string functions
// #include <sys/stat.h> // For mkdir
// #include <sys/types.h> // For mkdir
// #include "swad_action.h"
// #include "swad_box.h"
// #include "swad_database.h"
// #include "swad_error.h"
// #include "swad_exam_set.h"
// #include "swad_figure.h"
// #include "swad_form.h"
// #include "swad_global.h"
// #include "swad_hierarchy_level.h"
// #include "swad_HTML.h"
// #include "swad_ID.h"
// #include "swad_language.h"
// #include "swad_match.h"
// #include "swad_media.h"
// #include "swad_parameter.h"
#include "swad_question.h"
// #include "swad_question_import.h"
// #include "swad_tag_database.h"
// #include "swad_test.h"
// #include "swad_test_config.h"
// #include "swad_test_print.h"
// #include "swad_test_visibility.h"
// #include "swad_theme.h"
// #include "swad_user.h"
// #include "swad_xml.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
/*****************************************************************************/
/*****************************************************************************/
/**************************** Private constants ******************************/
/*****************************************************************************/
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/************************* Private global variables **************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
/*****************************************************************************/
/***************** Change format of answers text / feedback ******************/
/*****************************************************************************/
void Qst_ChangeFormatAnswersText (struct Qst_Question *Question)
{
unsigned NumOpt;
/***** Change format of answers text *****/
for (NumOpt = 0;
NumOpt < Question->Answer.NumOptions;
NumOpt++)
/* Convert answer text, that is in HTML, to rigorous HTML */
if (Question->Answer.Options[NumOpt].Text[0])
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
Question->Answer.Options[NumOpt].Text,
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK,false);
}
void Qst_ChangeFormatAnswersFeedback (struct Qst_Question *Question)
{
unsigned NumOpt;
/***** Change format of answers text and feedback *****/
for (NumOpt = 0;
NumOpt < Question->Answer.NumOptions;
NumOpt++)
/* Convert answer feedback, that is in HTML, to rigorous HTML */
if (Question->Answer.Options[NumOpt].Feedback)
if (Question->Answer.Options[NumOpt].Feedback[0])
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
Question->Answer.Options[NumOpt].Feedback,
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK,false);
}

120
swad_question.h Normal file
View File

@ -0,0 +1,120 @@
// swad_question.h: test/exam/game questions
#ifndef _SWAD_QST
#define _SWAD_QST
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2021 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include <stdbool.h> // For boolean type
#include <time.h> // For time_t
// #include "swad_question_type.h"
#include "swad_media.h"
#include "swad_string.h"
#include "swad_tag.h"
// #include "swad_test_config.h"
// #include "swad_test_visibility.h"
// #include "swad_user.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
/*****************************************************************************/
#define Qst_MAX_BYTES_ANSWER_TYPE 32
#define Qst_MAX_BYTES_FLOAT_ANSWER 30 // Maximum length of the strings that store an floating point answer
#define Qst_MAX_OPTIONS_PER_QUESTION 10
#define Qst_MAX_BYTES_INDEXES_ONE_QST (Qst_MAX_OPTIONS_PER_QUESTION * (3 + 1))
#define Qst_MAX_CHARS_ANSWER_OR_FEEDBACK (1024 - 1) // 1023
#define Qst_MAX_BYTES_ANSWER_OR_FEEDBACK ((Qst_MAX_CHARS_ANSWER_OR_FEEDBACK + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 16383
#define Qst_MAX_CHARS_ANSWERS_ONE_QST (128 - 1) // 127
#define Qst_MAX_BYTES_ANSWERS_ONE_QST ((Qst_MAX_CHARS_ANSWERS_ONE_QST + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
#define Qst_NUM_VALIDITIES 2
typedef enum
{
Qst_INVALID_QUESTION,
Qst_VALID_QUESTION,
} Qst_Validity_t;
#define Qst_NUM_ANS_TYPES 6
#define Qst_MAX_BYTES_LIST_ANSWER_TYPES (Qst_NUM_ANS_TYPES * (Cns_MAX_DECIMAL_DIGITS_UINT + 1))
typedef enum
{
Qst_ANS_INT = 0,
Qst_ANS_FLOAT = 1,
Qst_ANS_TRUE_FALSE = 2,
Qst_ANS_UNIQUE_CHOICE = 3,
Qst_ANS_MULTIPLE_CHOICE = 4,
Qst_ANS_TEXT = 5,
Qst_ANS_UNKNOWN = 6, // Unknown/all/any type of answer
} Qst_AnswerType_t;
struct Qst_Question
{
long QstCod;
struct Tag_Tags Tags;
time_t EditTime;
char *Stem;
char *Feedback;
struct Med_Media Media;
struct
{
Qst_AnswerType_t Type;
unsigned NumOptions;
bool Shuffle;
char TF;
struct
{
bool Correct;
char *Text;
char *Feedback;
struct Med_Media Media;
} Options[Qst_MAX_OPTIONS_PER_QUESTION];
long Integer;
double FloatingPoint[2];
} Answer;
unsigned long NumHits;
unsigned long NumHitsNotBlank;
double Score;
Qst_Validity_t Validity; // If a question in an exam has been marked as invalid
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Qst_ChangeFormatAnswersText (struct Qst_Question *Question);
void Qst_ChangeFormatAnswersFeedback (struct Qst_Question *Question);
#endif

View File

@ -719,7 +719,7 @@ static void QstImp_GetAnswerFromXML (struct XMLElement *AnswerElem,
if (AnswerElem->Content)
Str_Copy (Question->Answer.Options[0].Text,AnswerElem->Content,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
break;
case Qst_ANS_FLOAT:
if (!Qst_AllocateTextChoiceAnswer (Question,0))
@ -737,7 +737,7 @@ static void QstImp_GetAnswerFromXML (struct XMLElement *AnswerElem,
if (LowerUpperElem->Content)
Str_Copy (Question->Answer.Options[0].Text,
LowerUpperElem->Content,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
break; // Only first element "lower"
}
for (LowerUpperElem = AnswerElem->FirstChild;
@ -748,7 +748,7 @@ static void QstImp_GetAnswerFromXML (struct XMLElement *AnswerElem,
if (LowerUpperElem->Content)
Str_Copy (Question->Answer.Options[1].Text,
LowerUpperElem->Content,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
break; // Only first element "upper"
}
break;
@ -791,12 +791,12 @@ static void QstImp_GetAnswerFromXML (struct XMLElement *AnswerElem,
{
Str_Copy (Question->Answer.Options[NumOpt].Text,
TextElem->Content,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
/* Convert answer from text to HTML (in database answer text is stored in HTML) */
Str_ChangeFormat (Str_FROM_TEXT,Str_TO_HTML,
Question->Answer.Options[NumOpt].Text,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK,true);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK,true);
}
break; // Only first element "text"
}
@ -810,12 +810,12 @@ static void QstImp_GetAnswerFromXML (struct XMLElement *AnswerElem,
{
Str_Copy (Question->Answer.Options[NumOpt].Feedback,
FeedbackElem->Content,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
/* Convert feedback from text to HTML (in database answer feedback is stored in HTML) */
Str_ChangeFormat (Str_FROM_TEXT,Str_TO_HTML,
Question->Answer.Options[NumOpt].Feedback,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK,true);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK,true);
}
break; // Only first element "feedback"
}

View File

@ -34,69 +34,10 @@
/***************************** Public constants ******************************/
/*****************************************************************************/
#define Qst_MAX_BYTES_FLOAT_ANSWER 30 // Maximum length of the strings that store an floating point answer
#define Qst_MAX_OPTIONS_PER_QUESTION 10
#define Qst_MAX_BYTES_INDEXES_ONE_QST (Qst_MAX_OPTIONS_PER_QUESTION * (3 + 1))
#define Qst_MAX_CHARS_ANSWERS_ONE_QST (128 - 1) // 127
#define Qst_MAX_BYTES_ANSWERS_ONE_QST ((Qst_MAX_CHARS_ANSWERS_ONE_QST + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
#define Qst_NUM_VALIDITIES 2
typedef enum
{
Qst_INVALID_QUESTION,
Qst_VALID_QUESTION,
} Qst_Validity_t;
#define Qst_NUM_ANS_TYPES 6
#define Qst_MAX_BYTES_LIST_ANSWER_TYPES (Qst_NUM_ANS_TYPES * (Cns_MAX_DECIMAL_DIGITS_UINT + 1))
typedef enum
{
Qst_ANS_INT = 0,
Qst_ANS_FLOAT = 1,
Qst_ANS_TRUE_FALSE = 2,
Qst_ANS_UNIQUE_CHOICE = 3,
Qst_ANS_MULTIPLE_CHOICE = 4,
Qst_ANS_TEXT = 5,
Qst_ANS_UNKNOWN = 6, // Unknown/all/any type of answer
} Qst_AnswerType_t;
struct Qst_Question
{
long QstCod;
struct Tag_Tags Tags;
time_t EditTime;
char *Stem;
char *Feedback;
struct Med_Media Media;
struct
{
Qst_AnswerType_t Type;
unsigned NumOptions;
bool Shuffle;
char TF;
struct
{
bool Correct;
char *Text;
char *Feedback;
struct Med_Media Media;
} Options[Qst_MAX_OPTIONS_PER_QUESTION];
long Integer;
double FloatingPoint[2];
} Answer;
unsigned long NumHits;
unsigned long NumHitsNotBlank;
double Score;
Qst_Validity_t Validity; // If a question in an exam has been marked as invalid
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/

View File

@ -52,6 +52,7 @@
#include "swad_match.h"
#include "swad_media.h"
#include "swad_parameter.h"
#include "swad_question.h"
#include "swad_question_import.h"
#include "swad_tag_database.h"
#include "swad_test.h"
@ -2685,41 +2686,6 @@ void Qst_GetAnswersQst (struct Qst_Question *Question,MYSQL_RES **mysql_res,
Err_WrongAnswerExit ();
}
/*****************************************************************************/
/***************** Change format of answers text / feedback ******************/
/*****************************************************************************/
void Qst_ChangeFormatAnswersText (struct Qst_Question *Question)
{
unsigned NumOpt;
/***** Change format of answers text *****/
for (NumOpt = 0;
NumOpt < Question->Answer.NumOptions;
NumOpt++)
/* Convert answer text, that is in HTML, to rigorous HTML */
if (Question->Answer.Options[NumOpt].Text[0])
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
Question->Answer.Options[NumOpt].Text,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK,false);
}
void Qst_ChangeFormatAnswersFeedback (struct Qst_Question *Question)
{
unsigned NumOpt;
/***** Change format of answers text and feedback *****/
for (NumOpt = 0;
NumOpt < Question->Answer.NumOptions;
NumOpt++)
/* Convert answer feedback, that is in HTML, to rigorous HTML */
if (Question->Answer.Options[NumOpt].Feedback)
if (Question->Answer.Options[NumOpt].Feedback[0])
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
Question->Answer.Options[NumOpt].Feedback,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK,false);
}
/*****************************************************************************/
/**************** Get and write the answers of a test question ***************/
/*****************************************************************************/
@ -3654,14 +3620,14 @@ void Qst_QstDestructor (struct Qst_Question *Question)
bool Qst_AllocateTextChoiceAnswer (struct Qst_Question *Question,unsigned NumOpt)
{
if ((Question->Answer.Options[NumOpt].Text =
malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
malloc (Qst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
{
Ale_CreateAlert (Ale_ERROR,NULL,
"Not enough memory to store answer.");
return false;
}
if ((Question->Answer.Options[NumOpt].Feedback =
malloc (Tst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
malloc (Qst_MAX_BYTES_ANSWER_OR_FEEDBACK + 1)) == NULL)
{
Ale_CreateAlert (Ale_ERROR,NULL,
"Not enough memory to store feedback.");
@ -3895,12 +3861,12 @@ bool Qst_GetQstDataFromDB (struct Qst_Question *Question)
if (row[1])
if (row[1][0])
Str_Copy (Question->Answer.Options[NumOpt].Text ,row[1],
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Question->Answer.Options[NumOpt].Feedback[0] = '\0';
if (row[2])
if (row[2][0])
Str_Copy (Question->Answer.Options[NumOpt].Feedback,row[2],
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
/* Get media (row[3]) */
Question->Answer.Options[NumOpt].Media.MedCod = Str_ConvertStrCodToLongCod (row[3]);
@ -4162,7 +4128,7 @@ static void Qst_GetQstFromForm (struct Qst_Question *Question)
/* Get answer */
snprintf (AnsStr,sizeof (AnsStr),"AnsStr%u",NumOpt);
Par_GetParToHTML (AnsStr,Question->Answer.Options[NumOpt].Text,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
if (Question->Answer.Type == Qst_ANS_TEXT)
/* In order to compare student answer to stored answer,
the text answers are stored avoiding two or more consecurive spaces */
@ -4171,7 +4137,7 @@ static void Qst_GetQstFromForm (struct Qst_Question *Question)
/* Get feedback */
snprintf (FbStr,sizeof (FbStr),"FbStr%u",NumOpt);
Par_GetParToHTML (FbStr,Question->Answer.Options[NumOpt].Feedback,
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
/* Get media associated to the answer (action, file and title) */
if (Question->Answer.Type == Qst_ANS_UNIQUE_CHOICE ||

View File

@ -30,6 +30,7 @@
#include "swad_exam.h"
#include "swad_game.h"
#include "swad_media.h"
#include "swad_question.h"
#include "swad_question_type.h"
#include "swad_test_config.h"
#include "swad_test_print.h"
@ -38,11 +39,6 @@
/***************************** Public constants ******************************/
/*****************************************************************************/
#define Tst_MAX_CHARS_ANSWER_OR_FEEDBACK (1024 - 1) // 1023
#define Tst_MAX_BYTES_ANSWER_OR_FEEDBACK ((Tst_MAX_CHARS_ANSWER_OR_FEEDBACK + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 16383
#define Qst_MAX_BYTES_ANSWER_TYPE 32
#define Tst_SCORE_MAX 10 // Maximum score of a test (10 in Spain). Must be unsigned! // TODO: Make this configurable by teachers
/*****************************************************************************/
@ -128,9 +124,6 @@ unsigned Qst_GetNumAnswersQst (long QstCod);
void Qst_GetAnswersQst (struct Qst_Question *Question,MYSQL_RES **mysql_res,
bool Shuffle);
void Qst_ChangeFormatAnswersText (struct Qst_Question *Question);
void Qst_ChangeFormatAnswersFeedback (struct Qst_Question *Question);
void Qst_WriteAnswersBank (struct Qst_Question *Question,
const char *ClassTxt,
const char *ClassFeedback);

View File

@ -40,6 +40,7 @@
#include "swad_HTML.h"
#include "swad_ID.h"
#include "swad_photo.h"
#include "swad_question.h"
#include "swad_test.h"
#include "swad_test_print.h"
#include "swad_test_visibility.h"
@ -1021,7 +1022,7 @@ static void TstPrn_GetCorrectTxtAnswerFromDB (struct Qst_Question *Question)
/***** Copy answer text (row[0]) ******/
Str_Copy (Question->Answer.Options[NumOpt].Text,row[0],
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
Qst_MAX_BYTES_ANSWER_OR_FEEDBACK);
}
/***** Change format of answers text *****/

View File

@ -27,6 +27,7 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
#include "swad_question.h"
#include "swad_question_type.h"
#include "swad_test_config.h"
#include "swad_test_visibility.h"