mirror of https://github.com/acanas/swad-core.git
Version19.260.1
This commit is contained in:
parent
e316293f0c
commit
57a40730bb
26
swad_API.c
26
swad_API.c
|
@ -5200,6 +5200,12 @@ int swad__getMatchStatus (struct soap *soap,
|
|||
Game.GamCod = (long) gameCode;
|
||||
Match.MchCod = (long) matchCode;
|
||||
|
||||
/***** Default output *****/
|
||||
getMatchStatusOut->matchCode = -1;
|
||||
getMatchStatusOut->questionIndex = -1;
|
||||
getMatchStatusOut->numAnswers = -1;
|
||||
getMatchStatusOut->answerIndex = -1;
|
||||
|
||||
/***** Check web service key *****/
|
||||
if ((ReturnCode = API_CheckWSKey (wsKey)) != SOAP_OK)
|
||||
return ReturnCode;
|
||||
|
@ -5266,8 +5272,9 @@ int swad__getMatchStatus (struct soap *soap,
|
|||
if (Match.Status.Playing && // Match is being played
|
||||
Match.Status.Showing != Mch_END) // Unfinished
|
||||
/* Update players */
|
||||
getMatchStatusOut->matchCode = Mch_RegisterMeAsPlayerInMatch (&Match) ? matchCode : // > 0 ==> OK
|
||||
-1; // < 0 ==> can not join this match
|
||||
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;
|
||||
|
@ -5383,13 +5390,14 @@ int swad__answerMatchQuestion (struct soap *soap,
|
|||
|
||||
/***** Check number of option selected by student *****/
|
||||
if (numOption < 0)
|
||||
return soap_sender_fault (soap,
|
||||
"Bad number of option",
|
||||
"The number of option should be greater or equal than 0");
|
||||
UsrAnswer.NumOpt = (unsigned) numOption;
|
||||
|
||||
/***** Store answer *****/
|
||||
Mch_StoreQuestionAnswer (&Match,QstInd,&UsrAnswer);
|
||||
/***** Remove my answer to this question *****/
|
||||
Mch_RemoveMyQuestionAnswer (&Match,QstInd);
|
||||
else
|
||||
{
|
||||
/***** Store answer *****/
|
||||
UsrAnswer.NumOpt = (unsigned) numOption;
|
||||
Mch_StoreQuestionAnswer (&Match,QstInd,&UsrAnswer);
|
||||
}
|
||||
|
||||
return SOAP_OK;
|
||||
}
|
||||
|
|
|
@ -761,7 +761,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
|
||||
[ActJoiMch ] = {1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mch_GetMatchBeingPlayed ,Mch_JoinMatchAsStd ,NULL},
|
||||
[ActSeeMchAnsQstStd ] = {1808,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_JoinMatchAsStd ,NULL},
|
||||
[ActRemMchAnsQstStd ] = {1809,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_RemoveMyQuestionAnswer ,NULL},
|
||||
[ActRemMchAnsQstStd ] = {1809,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_RemMyQstAnsAndShowMchStatus ,NULL},
|
||||
[ActAnsMchQstStd ] = {1651,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ReceiveQuestionAnswer ,NULL},
|
||||
[ActRefMchStd ] = {1782,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Mch_GetMatchBeingPlayed ,Mch_RefreshMatchStd ,NULL},
|
||||
|
||||
|
|
|
@ -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.259 (2020-08-22)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.260.1 (2020-08-26)"
|
||||
#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.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)
|
||||
Version 19.258: Aug 11, 2020 Changes in API functions related to games and matches. (303951 lines)
|
||||
|
|
38
swad_match.c
38
swad_match.c
|
@ -3733,7 +3733,7 @@ void Mch_JoinMatchAsStd (void)
|
|||
/****** Remove student's answer to a question and show match as student ******/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Mch_RemoveMyQuestionAnswer (void)
|
||||
void Mch_RemMyQstAnsAndShowMchStatus (void)
|
||||
{
|
||||
struct Mch_Match Match;
|
||||
unsigned QstInd;
|
||||
|
@ -3748,18 +3748,8 @@ void Mch_RemoveMyQuestionAnswer (void)
|
|||
/***** Get question index from form *****/
|
||||
QstInd = Gam_GetParamQstInd ();
|
||||
|
||||
/***** Check that teacher's screen is showing answers
|
||||
and question index is the current one being played *****/
|
||||
if (Match.Status.Playing && // Match is being played
|
||||
Match.Status.Showing == Mch_ANSWERS && // Teacher's screen is showing answers
|
||||
QstInd == Match.Status.QstInd) // Removing answer to the current question being played
|
||||
{
|
||||
/***** Remove my answer to this question *****/
|
||||
Mch_RemoveMyAnswerToMatchQuestion (&Match);
|
||||
|
||||
/***** Compute score and update my match result *****/
|
||||
MchPrn_ComputeScoreAndUpdateMyMatchPrintInDB (Match.MchCod);
|
||||
}
|
||||
/***** Remove my answer to this question *****/
|
||||
Mch_RemoveMyQuestionAnswer (&Match,QstInd);
|
||||
|
||||
/***** Show current match status *****/
|
||||
HTM_DIV_Begin ("id=\"match\" class=\"MCH_CONT\"");
|
||||
|
@ -3767,6 +3757,26 @@ void Mch_RemoveMyQuestionAnswer (void)
|
|||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Remove student's answer to a question ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Mch_RemoveMyQuestionAnswer (const struct Mch_Match *Match,unsigned QstInd)
|
||||
{
|
||||
/***** Check that teacher's screen is showing answers
|
||||
and question index is the current one being played *****/
|
||||
if (Match->Status.Playing && // Match is being played
|
||||
Match->Status.Showing == Mch_ANSWERS && // Teacher's screen is showing answers
|
||||
QstInd == Match->Status.QstInd) // Removing answer to the current question being played
|
||||
{
|
||||
/***** Remove my answer to this question *****/
|
||||
Mch_RemoveMyAnswerToMatchQuestion (Match);
|
||||
|
||||
/***** Compute score and update my match result *****/
|
||||
MchPrn_ComputeScoreAndUpdateMyMatchPrintInDB (Match->MchCod);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Start match countdown (by a teacher) *******************/
|
||||
/*****************************************************************************/
|
||||
|
@ -3961,7 +3971,7 @@ void Mch_ReceiveQuestionAnswer (void)
|
|||
/********** Store question answer from student when playing a match **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Mch_StoreQuestionAnswer (struct Mch_Match *Match,unsigned QstInd,
|
||||
void Mch_StoreQuestionAnswer (const struct Mch_Match *Match,unsigned QstInd,
|
||||
struct Mch_UsrAnswer *UsrAnswer)
|
||||
{
|
||||
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION];
|
||||
|
|
|
@ -136,7 +136,8 @@ bool Mch_RegisterMeAsPlayerInMatch (struct Mch_Match *Match);
|
|||
|
||||
void Mch_GetMatchBeingPlayed (void);
|
||||
void Mch_JoinMatchAsStd (void);
|
||||
void Mch_RemoveMyQuestionAnswer (void);
|
||||
void Mch_RemMyQstAnsAndShowMchStatus (void);
|
||||
void Mch_RemoveMyQuestionAnswer (const struct Mch_Match *Match,unsigned QstInd);
|
||||
|
||||
void Mch_StartCountdown (void);
|
||||
void Mch_RefreshMatchTch (void);
|
||||
|
@ -145,7 +146,7 @@ void Mch_RefreshMatchStd (void);
|
|||
void Mch_GetQstAnsFromDB (long MchCod,long UsrCod,unsigned QstInd,
|
||||
struct Mch_UsrAnswer *UsrAnswer);
|
||||
void Mch_ReceiveQuestionAnswer (void);
|
||||
void Mch_StoreQuestionAnswer (struct Mch_Match *Match,unsigned QstInd,
|
||||
void Mch_StoreQuestionAnswer (const struct Mch_Match *Match,unsigned QstInd,
|
||||
struct Mch_UsrAnswer *UsrAnswer);
|
||||
|
||||
void Mch_GetMatchQuestionsFromDB (struct MchPrn_Print *Print);
|
||||
|
|
Loading…
Reference in New Issue