Version18.127.1

This commit is contained in:
Antonio Cañas Vargas 2019-05-31 00:40:23 +02:00
parent ead1645756
commit 3ba9647b4f
5 changed files with 76 additions and 96 deletions

View File

@ -611,7 +611,6 @@ Assessment:
456. ActNewMch Create a new match showing first question in a new browser tab (by a teacher)
NEW. ActResMch Resume an unfinished match showing current question in a new browser tab (by a teacher)
457. ActNxtMch Show next question when playing a game (by a teacher)
NEW. ActEndMch Finish a match (by a teacher)
NEW. ActPlyMchStd Play a game (by a student)
NEW. ActGamStdCurQst Show current question when playing a game (by a student)
@ -2149,7 +2148,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActNewMch */{1671,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_CreateAndStartNewMatch ,NULL},
/* ActResMch */{1785,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_ResumeUnfinishedMatch ,NULL},
/* ActNxtMch */{1672,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_NextStatusMatch ,NULL},
/* ActEndMch */{1781,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_MatchTchEnd ,NULL},
/* ActPlyMchStd */{1779,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_PlayMatchStd ,NULL},
/* ActGamStdCurQst */{1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Gam_GetMatchBeingPlayed ,Gam_ShowNewMatchToMeAsStd ,NULL},
@ -4986,7 +4984,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActUnlAllPrj, // #1778
ActPlyMchStd, // #1779
ActGamStdCurQst, // #1780
ActEndMch, // #1781
-1, // #1781 (obsolete action)
ActRefGamStd, // #1782
ActReqRemMch, // #1783
ActRemMch, // #1784

View File

@ -64,7 +64,7 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 169 + 437 + 176 + 169 + 16 + 67)
#define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 168 + 437 + 176 + 169 + 16 + 67)
#define Act_MAX_ACTION_COD 1785
@ -613,55 +613,54 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActNewMch (ActChgCrsTT1stDay + 120)
#define ActResMch (ActChgCrsTT1stDay + 121)
#define ActNxtMch (ActChgCrsTT1stDay + 122)
#define ActEndMch (ActChgCrsTT1stDay + 123)
#define ActPlyMchStd (ActChgCrsTT1stDay + 124)
#define ActGamStdCurQst (ActChgCrsTT1stDay + 125)
#define ActRefGamStd (ActChgCrsTT1stDay + 126)
#define ActAnsGam (ActChgCrsTT1stDay + 127)
#define ActFrmNewGam (ActChgCrsTT1stDay + 128)
#define ActEdiOneGam (ActChgCrsTT1stDay + 129)
#define ActNewGam (ActChgCrsTT1stDay + 130)
#define ActChgGam (ActChgCrsTT1stDay + 131)
#define ActReqRemGam (ActChgCrsTT1stDay + 132)
#define ActRemGam (ActChgCrsTT1stDay + 133)
#define ActReqRstGam (ActChgCrsTT1stDay + 134)
#define ActRstGam (ActChgCrsTT1stDay + 135)
#define ActHidGam (ActChgCrsTT1stDay + 136)
#define ActShoGam (ActChgCrsTT1stDay + 137)
#define ActAddOneGamQst (ActChgCrsTT1stDay + 138)
#define ActGamLstTstQst (ActChgCrsTT1stDay + 139)
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 140)
#define ActReqRemGamQst (ActChgCrsTT1stDay + 141)
#define ActRemGamQst (ActChgCrsTT1stDay + 142)
#define ActUp_GamQst (ActChgCrsTT1stDay + 143)
#define ActDwnGamQst (ActChgCrsTT1stDay + 144)
#define ActPlyMchStd (ActChgCrsTT1stDay + 123)
#define ActGamStdCurQst (ActChgCrsTT1stDay + 124)
#define ActRefGamStd (ActChgCrsTT1stDay + 125)
#define ActAnsGam (ActChgCrsTT1stDay + 126)
#define ActFrmNewGam (ActChgCrsTT1stDay + 127)
#define ActEdiOneGam (ActChgCrsTT1stDay + 128)
#define ActNewGam (ActChgCrsTT1stDay + 129)
#define ActChgGam (ActChgCrsTT1stDay + 130)
#define ActReqRemGam (ActChgCrsTT1stDay + 131)
#define ActRemGam (ActChgCrsTT1stDay + 132)
#define ActReqRstGam (ActChgCrsTT1stDay + 133)
#define ActRstGam (ActChgCrsTT1stDay + 134)
#define ActHidGam (ActChgCrsTT1stDay + 135)
#define ActShoGam (ActChgCrsTT1stDay + 136)
#define ActAddOneGamQst (ActChgCrsTT1stDay + 137)
#define ActGamLstTstQst (ActChgCrsTT1stDay + 138)
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 139)
#define ActReqRemGamQst (ActChgCrsTT1stDay + 140)
#define ActRemGamQst (ActChgCrsTT1stDay + 141)
#define ActUp_GamQst (ActChgCrsTT1stDay + 142)
#define ActDwnGamQst (ActChgCrsTT1stDay + 143)
#define ActSeeSvy (ActChgCrsTT1stDay + 145)
#define ActAnsSvy (ActChgCrsTT1stDay + 146)
#define ActFrmNewSvy (ActChgCrsTT1stDay + 147)
#define ActEdiOneSvy (ActChgCrsTT1stDay + 148)
#define ActNewSvy (ActChgCrsTT1stDay + 149)
#define ActChgSvy (ActChgCrsTT1stDay + 150)
#define ActReqRemSvy (ActChgCrsTT1stDay + 151)
#define ActRemSvy (ActChgCrsTT1stDay + 152)
#define ActReqRstSvy (ActChgCrsTT1stDay + 153)
#define ActRstSvy (ActChgCrsTT1stDay + 154)
#define ActHidSvy (ActChgCrsTT1stDay + 155)
#define ActShoSvy (ActChgCrsTT1stDay + 156)
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 157)
#define ActRcvSvyQst (ActChgCrsTT1stDay + 158)
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 159)
#define ActRemSvyQst (ActChgCrsTT1stDay + 160)
#define ActSeeSvy (ActChgCrsTT1stDay + 144)
#define ActAnsSvy (ActChgCrsTT1stDay + 145)
#define ActFrmNewSvy (ActChgCrsTT1stDay + 146)
#define ActEdiOneSvy (ActChgCrsTT1stDay + 147)
#define ActNewSvy (ActChgCrsTT1stDay + 148)
#define ActChgSvy (ActChgCrsTT1stDay + 149)
#define ActReqRemSvy (ActChgCrsTT1stDay + 150)
#define ActRemSvy (ActChgCrsTT1stDay + 151)
#define ActReqRstSvy (ActChgCrsTT1stDay + 152)
#define ActRstSvy (ActChgCrsTT1stDay + 153)
#define ActHidSvy (ActChgCrsTT1stDay + 154)
#define ActShoSvy (ActChgCrsTT1stDay + 155)
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 156)
#define ActRcvSvyQst (ActChgCrsTT1stDay + 157)
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 158)
#define ActRemSvyQst (ActChgCrsTT1stDay + 159)
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 161)
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 162)
#define ActEdiExaAnn (ActChgCrsTT1stDay + 163)
#define ActRcvExaAnn (ActChgCrsTT1stDay + 164)
#define ActPrnExaAnn (ActChgCrsTT1stDay + 165)
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 166)
#define ActRemExaAnn (ActChgCrsTT1stDay + 167)
#define ActHidExaAnn (ActChgCrsTT1stDay + 168)
#define ActShoExaAnn (ActChgCrsTT1stDay + 169)
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 160)
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 161)
#define ActEdiExaAnn (ActChgCrsTT1stDay + 162)
#define ActRcvExaAnn (ActChgCrsTT1stDay + 163)
#define ActPrnExaAnn (ActChgCrsTT1stDay + 164)
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 165)
#define ActRemExaAnn (ActChgCrsTT1stDay + 166)
#define ActHidExaAnn (ActChgCrsTT1stDay + 167)
#define ActShoExaAnn (ActChgCrsTT1stDay + 168)
/*****************************************************************************/
/******************************** Files tab **********************************/

View File

@ -434,6 +434,9 @@ Lo de mutear anuncios, en principio prefiero hacer una opci
// TODO: Cambiar QstInd al rango 1,2,3... (código especial 0 en lugar de -1) en swad_survey
// TODO: Probar qué ocurre si se está jugando una partida en una pestaña y se reanuda la misma en otra pestaña (da igual otra pestaña que otro navegador u ordenador)
// TODO: ¿Puede un profesor reanudar una partida comenzada por otro profesor?
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
@ -453,13 +456,14 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.127 (2019-05-30)"
#define Log_PLATFORM_VERSION "SWAD 18.127.1 (2019-05-31)"
#define CSS_FILE "swad18.123.css"
#define JS_FILE "swad18.123.js"
/*
1. ¿Qué ocurre si se está jugando una partida en una pestaña y se reanuda la misma en otra pestaña (da igual otra pestaña que otro navegador u ordenador)?
¿Cómo deben avanzar las dos instancias de la misma partida?
2. ¿Puede un profesor reanudar una partida comenzada por otro profesor?
Version 18.127.1: May 31, 2019 Removed action to end a match. (243464 lines)
1 change necessary in database:
UPDATE actions SET Obsolete='Y' WHERE ActCod=1781;
Version 18.127: May 30, 2019 Changes in game matches. (243481 lines)
1 change necessary in database:
UPDATE actions SET Obsolete='Y' WHERE ActCod=1673;

View File

@ -3213,6 +3213,13 @@ static void Gam_GetMatchDataFromRow (MYSQL_RES *mysql_res,
/* Get whether the match is finished or not (row(10)) */
Match->Status.Finished = (row[10][0] == 'Y');
/* If question index is 0 ==> the game is finished */
if (Match->Status.QstInd == 0)
{
Match->Status.QstCod = -1L;
Match->Status.Finished = true;
}
}
/*****************************************************************************/
@ -3496,15 +3503,15 @@ static void Gam_CreateMatch (struct Match *Match)
Match->Status.QstInd = Gam_GetFirstQuestionIndexInGame (Match->GamCod);
if (Match->Status.QstInd > 0)
{
Match->Status.QstCod = Gam_GetQstCodFromQstInd (Match->GamCod,Match->Status.QstInd);
Match->Status.QstCod = Gam_GetQstCodFromQstInd (Match->GamCod,Match->Status.QstInd);
Match->Status.ShowingAnswers = false; // Don't show answers initially
Match->Status.Finished = false; // Game not finished
Match->Status.Finished = false; // Game not finished
}
else // The game has no questions!
{
Match->Status.QstCod = -1L; // Non-existent question
Match->Status.QstCod = -1L; // Non-existent question
Match->Status.ShowingAnswers = false; // Don't show answers initially
Match->Status.Finished = true; // Game not finished
Match->Status.Finished = true; // Game not finished
}
/***** Insert this new match into database *****/
@ -3518,9 +3525,9 @@ static void Gam_CreateMatch (struct Match *Match)
Match->GamCod,Match->UsrCod,Match->Title,
Match->Status.QstInd,Match->Status.QstCod,
Match->Status.ShowingAnswers ? 'Y' :
'N',
Match->Status.Finished ? 'Y' :
'N');
'N',
Match->Status.Finished ? 'Y' :
'N');
/***** Create groups associated to the match *****/
if (Gbl.Crs.Grps.LstGrpsSel.NumGrps)
@ -3577,14 +3584,17 @@ static void Gam_UpdateMatchBeingPlayed (struct Match *Match)
" SET gam_matches.EndTime=NOW(),"
"gam_matches.QstInd=%u,"
"gam_matches.QstCod=%ld,"
"gam_matches.QstStartTime=NOW(),"
"gam_matches.ShowingAnswers='%c',"
"gam_matches.QstStartTime=NOW()"
"gam_matches.Finished='%c'"
" WHERE gam_matches.MchCod=%ld"
" AND gam_matches.GamCod=games.GamCod"
" AND games.CrsCod=%ld", // Extra check
Match->Status.QstInd,Match->Status.QstCod,
Match->Status.ShowingAnswers ? 'Y' :
'N',
Match->Status.Finished ? 'Y' :
'N',
Match->MchCod,Gbl.Hierarchy.Crs.CrsCod);
}
@ -3627,7 +3637,7 @@ void Gam_NextStatusMatch (void)
Match.Status.QstInd = 0; // No more questions
Match.Status.QstCod = -1L; // No more questions
Match.Status.ShowingAnswers = false; // Don't show answers
Match.Status.Finished = true; // Game is finished
Match.Status.Finished = true; // Game is finished
}
}
else
@ -3779,7 +3789,7 @@ static void Gam_PutBigButtonToFinishMatch (long MchCod)
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_CONTINUE_CONTAINER\">");
/***** Start form *****/
Frm_StartForm (ActEndMch);
Frm_StartForm (ActNxtMch);
Gam_PutParamMatchCod (MchCod);
/***** Put icon with link *****/
@ -3800,36 +3810,6 @@ static void Gam_PutBigButtonToFinishMatch (long MchCod)
fprintf (Gbl.F.Out,"</div>");
}
/*****************************************************************************/
/******************** End playing a match (by a teacher) *********************/
/*****************************************************************************/
void Gam_MatchTchEnd (void)
{
extern const char *Txt_Finished_match;
long MchCod;
/***** Get match code *****/
if ((MchCod = Gam_GetParamMatchCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of match is missing.");
/***** Update match being played *****/
DB_QueryUPDATE ("can not update match being played",
"UPDATE gam_matches,games"
" SET gam_matches.Finished='Y',"
"gam_matches.EndTime=NOW()"
" WHERE gam_matches.MchCod=%ld"
" AND gam_matches.GamCod=games.GamCod"
" AND games.CrsCod=%ld", // Extra check
MchCod,Gbl.Hierarchy.Crs.CrsCod);
/***** Show alert *****/
Ale_ShowAlert (Ale_INFO,Txt_Finished_match);
/***** Button to close browser tab *****/
Btn_PutCloseButton ("Cerrar"); // TODO: Need translation!!!!!
}
/*****************************************************************************/
/********************** Get code of match being played ************************/
/*****************************************************************************/

View File

@ -129,7 +129,6 @@ void Gam_ReceiveGameAnswers (void);
void Gam_CreateAndStartNewMatch (void);
void Gam_ResumeUnfinishedMatch (void);
void Gam_NextStatusMatch (void);
void Gam_MatchTchEnd (void);
void Gam_GetMatchBeingPlayed (void);
void Gam_ShowNewMatchToMeAsStd (void);