mirror of https://github.com/acanas/swad-core.git
Version19.260.2
This commit is contained in:
parent
57a40730bb
commit
cfde9b3ae9
49
swad_API.c
49
swad_API.c
|
@ -5186,7 +5186,6 @@ int swad__getMatchStatus (struct soap *soap,
|
|||
struct Gam_Game Game;
|
||||
struct Mch_Match Match;
|
||||
bool ICanPlayThisMatchBasedOnGrps;
|
||||
unsigned NumOptions;
|
||||
struct Mch_UsrAnswer UsrAnswer;
|
||||
|
||||
/***** Reset game and match *****/
|
||||
|
@ -5261,40 +5260,38 @@ int swad__getMatchStatus (struct soap *soap,
|
|||
"Request forbidden",
|
||||
"Requester can not join this match");
|
||||
|
||||
/***** Check question *****/
|
||||
if (!Tst_CheckIfQuestionIsValidForGame (Match.Status.QstCod))
|
||||
return soap_receiver_fault (soap,
|
||||
"Wrong question",
|
||||
"Type of answer not valid in a game.");
|
||||
|
||||
/***** Join match *****/
|
||||
/***** Set default match code *****/
|
||||
getMatchStatusOut->matchCode = 0; // == 0 ==> wait
|
||||
|
||||
/***** Set index of question inside the game *****/
|
||||
getMatchStatusOut->questionIndex = (int) Match.Status.QstInd;
|
||||
|
||||
if (Match.Status.Playing && // Match is being played
|
||||
Match.Status.Showing != Mch_END) // Unfinished
|
||||
/***** Join match *****/
|
||||
/* Update players */
|
||||
if (Mch_RegisterMeAsPlayerInMatch (&Match))
|
||||
if (Match.Status.Showing == Mch_ANSWERS) // Showing the question stem and the answers
|
||||
getMatchStatusOut->matchCode = (int) Match.MchCod; // > 0 ==> student is allowed to answer the question
|
||||
|
||||
/***** Set index of question inside the game *****/
|
||||
getMatchStatusOut->questionIndex = (int) Match.Status.QstInd;
|
||||
|
||||
/***** Set number of answers (options) in question *****/
|
||||
NumOptions = Tst_GetNumAnswersQst (Match.Status.QstCod);
|
||||
getMatchStatusOut->numAnswers = (int) NumOptions;
|
||||
|
||||
/***** Set number of selected answer *****/
|
||||
if (NumOptions == 0)
|
||||
getMatchStatusOut->answerIndex = -1;
|
||||
else // Answers found
|
||||
/***** Set number of answers (options) in question and student's answer (<0 ==> no answer) *****/
|
||||
switch (Match.Status.Showing)
|
||||
{
|
||||
/***** Get student's answer to this question
|
||||
(<0 ==> no answer) *****/
|
||||
Mch_GetQstAnsFromDB (Match.MchCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Match.Status.QstInd,
|
||||
&UsrAnswer);
|
||||
getMatchStatusOut->answerIndex = UsrAnswer.NumOpt;
|
||||
case Mch_START: // Start: don't show anything
|
||||
case Mch_END: // End: don't show anything
|
||||
getMatchStatusOut->numAnswers = 0;
|
||||
getMatchStatusOut->answerIndex = -1;
|
||||
break;
|
||||
case Mch_STEM: // Showing only the question stem
|
||||
case Mch_ANSWERS: // Showing the question stem and the answers
|
||||
case Mch_RESULTS: // Showing the results
|
||||
getMatchStatusOut->numAnswers = (int) Tst_GetNumAnswersQst (Match.Status.QstCod);
|
||||
Mch_GetQstAnsFromDB (Match.MchCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Match.Status.QstInd,
|
||||
&UsrAnswer);
|
||||
getMatchStatusOut->answerIndex = UsrAnswer.NumOpt;
|
||||
break;
|
||||
}
|
||||
|
||||
DB_QueryINSERT ("can not debug",
|
||||
|
|
|
@ -555,7 +555,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.260.1 (2020-08-26)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.260.2 (2020-08-28)"
|
||||
#define CSS_FILE "swad19.253.css"
|
||||
#define JS_FILE "swad19.254.js"
|
||||
/*
|
||||
|
@ -573,6 +573,7 @@ TODO: Que al generar un examen s
|
|||
TODO: Create module swad_test_result
|
||||
"sudo apt install webp" en Ubuntu, y "yum install libwebp libwebp-tools" en CentOS, para decodificar imágenes Web/ug reportado por Javier Fernández Baldomero.
|
||||
|
||||
Version 19.260.2: Aug 28, 2020 Fixed bugs in API functions related to games and matches. Reported by Sergio Díaz Rueda. (304010 lines)
|
||||
Version 19.260.1: Aug 26, 2020 Fixed bugs in API functions related to games and matches. Reported by Sergio Díaz Rueda. (304027 lines)
|
||||
Version 19.260: Aug 23, 2020 New API function getAvailableRoles. (304009 lines)
|
||||
Version 19.259: Aug 22, 2020 Changes in API function answerMatchQuestion. (303969 lines)
|
||||
|
|
13
swad_match.c
13
swad_match.c
|
@ -203,6 +203,9 @@ static void Mch_ShowQuestionAndAnswersTch (const struct Mch_Match *Match);
|
|||
static void Mch_WriteAnswersMatchResult (const struct Mch_Match *Match,
|
||||
struct Tst_Question *Question,
|
||||
const char *Class,bool ShowResult);
|
||||
static void Mch_WriteChoiceAnsViewMatch (const struct Mch_Match *Match,
|
||||
struct Tst_Question *Question,
|
||||
const char *Class,bool ShowResult);
|
||||
static bool Mch_ShowQuestionAndAnswersStd (const struct Mch_Match *Match,
|
||||
const struct Mch_UsrAnswer *UsrAnswer,
|
||||
Mch_Update_t Update);
|
||||
|
@ -3117,9 +3120,9 @@ static void Mch_WriteAnswersMatchResult (const struct Mch_Match *Match,
|
|||
/******** Write single or multiple choice answer when seeing a match *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Mch_WriteChoiceAnsViewMatch (const struct Mch_Match *Match,
|
||||
struct Tst_Question *Question,
|
||||
const char *Class,bool ShowResult)
|
||||
static void Mch_WriteChoiceAnsViewMatch (const struct Mch_Match *Match,
|
||||
struct Tst_Question *Question,
|
||||
const char *Class,bool ShowResult)
|
||||
{
|
||||
unsigned NumOpt;
|
||||
bool RowIsOpen = false;
|
||||
|
@ -3214,10 +3217,6 @@ static bool Mch_ShowQuestionAndAnswersStd (const struct Mch_Match *Match,
|
|||
unsigned NumOpt;
|
||||
char *Class;
|
||||
|
||||
/***** Trivial check: this question must be valid for games *****/
|
||||
if (!Tst_CheckIfQuestionIsValidForGame (Match->Status.QstCod))
|
||||
return false;
|
||||
|
||||
/***** Get number of options in this question *****/
|
||||
NumOptions = Tst_GetNumAnswersQst (Match->Status.QstCod);
|
||||
|
||||
|
|
|
@ -128,10 +128,6 @@ unsigned Mch_GetNumUnfinishedMchsInGame (long GamCod);
|
|||
|
||||
bool Mch_CheckIfICanPlayThisMatchBasedOnGrps (const struct Mch_Match *Match);
|
||||
|
||||
void Mch_WriteChoiceAnsViewMatch (const struct Mch_Match *Match,
|
||||
struct Tst_Question *Question,
|
||||
const char *Class,bool ShowResult);
|
||||
|
||||
bool Mch_RegisterMeAsPlayerInMatch (struct Mch_Match *Match);
|
||||
|
||||
void Mch_GetMatchBeingPlayed (void);
|
||||
|
|
14
swad_test.c
14
swad_test.c
|
@ -2792,20 +2792,6 @@ void Tst_WriteAnswersBank (struct Tst_Question *Question,
|
|||
Tst_WriteAnsBank[Question->Answer.Type] (Question,ClassTxt,ClassFeedback);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Check if a question is valid for a game *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Tst_CheckIfQuestionIsValidForGame (long QstCod)
|
||||
{
|
||||
/***** Check if a question is valid for a game from database *****/
|
||||
return DB_QueryCOUNT ("can not check type of a question",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM tst_questions"
|
||||
" WHERE QstCod=%ld AND AnsType='%s'",
|
||||
QstCod,Tst_StrAnswerTypesDB[Tst_ANS_UNIQUE_CHOICE]) != 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Write integer answer when editing a test *****************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -137,7 +137,6 @@ void Tst_ChangeFormatAnswersFeedback (struct Tst_Question *Question);
|
|||
void Tst_WriteAnswersBank (struct Tst_Question *Question,
|
||||
const char *ClassTxt,
|
||||
const char *ClassFeedback);
|
||||
bool Tst_CheckIfQuestionIsValidForGame (long QstCod);
|
||||
void Tst_WriteAnsTF (char AnsTF);
|
||||
|
||||
void Tst_WriteParamQstCod (unsigned NumQst,long QstCod);
|
||||
|
|
Loading…
Reference in New Issue