mirror of
https://github.com/acanas/swad-core.git
synced 2024-05-31 22:05:23 +02:00
Version18.132
This commit is contained in:
parent
08886f915b
commit
e75ddf0d51
|
@ -12868,3 +12868,7 @@ SELECT COUNT(*) FROM degrees WHERE CtrCod=2 AND FullName='M
|
|||
|
||||
SELECT UNIX_TIMESTAMP(MIN(StartTime)),UNIX_TIMESTAMP(MAX(EndTime)) FROM gam_matches WHERE GamCod=1;
|
||||
|
||||
----------------------
|
||||
|
||||
|
||||
SELECT MchCod,GamCod,UsrCod,UNIX_TIMESTAMP(StartTime),UNIX_TIMESTAMP(EndTime),Title,QstInd,QstCod,UNIX_TIMESTAMP(QstStartTime),ShowingAnswers,Finished FROM gam_matches WHERE GamCod=7 ORDER BY MchCod;
|
||||
|
|
|
@ -613,10 +613,10 @@ Assessment:
|
|||
457. ActNxtMch Show next question when playing a game (by a teacher)
|
||||
NEW. ActShoMch Show finished match results
|
||||
|
||||
NEW. ActPlyMchStd Show current question when playing a game (by a student)
|
||||
NEW. ActRefMchStd Refresh current question when playing a game (by a student)
|
||||
NEW. ActPlyMchStd Show current question when playing a game (as student)
|
||||
NEW. ActRefMchStd Refresh current question when playing a game (as student)
|
||||
459. ActAnsMchQstStd Answer a match question (as student)
|
||||
|
||||
459. ActAnsGam Answer a game
|
||||
460. ActFrmNewGam Form to create a new game
|
||||
461. ActEdiOneGam Edit one game
|
||||
462. ActNewGam Create new game
|
||||
|
@ -2154,8 +2154,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
|
||||
/* ActPlyMchStd */{1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Gam_GetMatchBeingPlayed ,Gam_ShowMatchToMeAsStd ,NULL},
|
||||
/* ActRefMchStd */{1782,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Gam_GetMatchBeingPlayed ,Gam_RefreshCurrentMatchStd ,NULL},
|
||||
/* ActAnsMchQstStd */{1651,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_204_NO_CONT,NULL ,Gam_ReceiveQstAnsFromStd ,NULL},
|
||||
|
||||
/* ActAnsGam */{1651,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ReceiveGameAnswers ,NULL},
|
||||
/* ActFrmNewGam */{1652,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},
|
||||
/* ActEdiOneGam */{1653,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},
|
||||
/* ActNewGam */{1654,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RecFormGame ,NULL},
|
||||
|
@ -4857,7 +4857,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
|
|||
ActChgCtrPlcCfg, // #1648
|
||||
ActSeeAllGam, // #1649
|
||||
ActSeeGam, // #1650
|
||||
ActAnsGam, // #1651
|
||||
ActAnsMchQstStd, // #1651
|
||||
ActFrmNewGam, // #1652
|
||||
ActEdiOneGam, // #1653
|
||||
ActNewGam, // #1654
|
||||
|
|
|
@ -616,7 +616,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActShoMch (ActChgCrsTT1stDay + 123)
|
||||
#define ActPlyMchStd (ActChgCrsTT1stDay + 124)
|
||||
#define ActRefMchStd (ActChgCrsTT1stDay + 125)
|
||||
#define ActAnsGam (ActChgCrsTT1stDay + 126)
|
||||
#define ActAnsMchQstStd (ActChgCrsTT1stDay + 126)
|
||||
#define ActFrmNewGam (ActChgCrsTT1stDay + 127)
|
||||
#define ActEdiOneGam (ActChgCrsTT1stDay + 128)
|
||||
#define ActNewGam (ActChgCrsTT1stDay + 129)
|
||||
|
|
|
@ -458,10 +458,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.131 (2019-07-04)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.132 (2019-07-09)"
|
||||
#define CSS_FILE "swad18.131.css"
|
||||
#define JS_FILE "swad18.130.2.js"
|
||||
/*
|
||||
Version 18.132: Jul 09, 2019 Reception of student answer to a match question. Not finished. (243461 lines)
|
||||
Version 18.131: Jul 04, 2019 Changes in matches. (243426 lines)
|
||||
Version 18.130.2: Jul 04, 2019 Changes in listing of games and matches for students. (243429 lines)
|
||||
1 change necessary in database:
|
||||
|
|
113
swad_game.c
113
swad_game.c
|
@ -190,9 +190,9 @@ static void Gam_PutBigButton (long MchCod,const char *Txt,const char *Icon);
|
|||
|
||||
static void Gam_ShowMatchStatusForStd (struct Match *Match);
|
||||
|
||||
static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod);
|
||||
static void Gam_ReceiveAndStoreStdAnswerToQst (struct Match *Match);
|
||||
static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd);
|
||||
static void Gam_RegisterIHaveAnsweredGame (long GamCod);
|
||||
// static void Gam_RegisterIHaveAnsweredGame (long GamCod);
|
||||
static bool Gam_CheckIfIHaveAnsweredGame (long GamCod);
|
||||
static unsigned Gam_GetNumUsrsWhoHaveAnsweredGame (long GamCod);
|
||||
|
||||
|
@ -3617,8 +3617,13 @@ void Gam_RefreshCurrentMatchStd (void)
|
|||
static void Gam_ShowMatchStatusForStd (struct Match *Match)
|
||||
{
|
||||
bool IBelongToGroups;
|
||||
bool Shuffle = false; // TODO: Read shuffle from question
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumOptions;
|
||||
unsigned NumOpt;
|
||||
unsigned Index;
|
||||
bool ErrorInIndex = false;
|
||||
|
||||
/***** Do I belong to valid groups to play this match? *****/
|
||||
IBelongToGroups = Gbl.Usrs.Me.IBelongToCurrentCrs &&
|
||||
|
@ -3648,7 +3653,7 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match)
|
|||
|
||||
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_STD_QST_CONTAINER\">");
|
||||
|
||||
/* Write answers? */
|
||||
/* Write buttons for answers? */
|
||||
if (Match->Status.ShowingAnswers)
|
||||
{
|
||||
if (Tst_CheckIfQuestionIsValidForGame (Match->Status.QstCod))
|
||||
|
@ -3658,22 +3663,63 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match)
|
|||
|
||||
/***** Write answers *****/
|
||||
NumOptions = Tst_GetNumAnswersQst (Match->Status.QstCod);
|
||||
|
||||
/***** Get answers of a question from database *****/
|
||||
Shuffle = false;
|
||||
NumOptions = Tst_GetAnswersQst (Match->Status.QstCod,&mysql_res,Shuffle);
|
||||
/*
|
||||
row[0] AnsInd
|
||||
row[1] Answer
|
||||
row[2] Feedback
|
||||
row[3] MedCod
|
||||
row[4] Correct
|
||||
*/
|
||||
|
||||
for (NumOpt = 0;
|
||||
NumOpt < NumOptions;
|
||||
NumOpt++)
|
||||
{
|
||||
/***** Get next answer *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/***** Assign index (row[0]).
|
||||
Index is 0,1,2,3... if no shuffle
|
||||
or 1,3,0,2... (example) if shuffle *****/
|
||||
if (sscanf (row[0],"%u",&Index) == 1)
|
||||
{
|
||||
if (Index >= Tst_MAX_OPTIONS_PER_QUESTION)
|
||||
ErrorInIndex = true;
|
||||
}
|
||||
else
|
||||
ErrorInIndex = true;
|
||||
if (ErrorInIndex)
|
||||
Lay_ShowErrorAndExit ("Wrong index of answer when showing a test.");
|
||||
|
||||
/***** Start row *****/
|
||||
// if (NumOpt % 2 == 0)
|
||||
fprintf (Gbl.F.Out,"<tr>");
|
||||
|
||||
/***** Write letter for this option *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"GAM_PLAY_STD_CELL\">"
|
||||
"<div class=\"GAM_PLAY_STD_BUTTON BT_%c\">"
|
||||
/* Start table cell */
|
||||
fprintf (Gbl.F.Out,"<td class=\"GAM_PLAY_STD_CELL\">");
|
||||
|
||||
/* Form with button */
|
||||
Frm_StartForm (ActAnsMchQstStd);
|
||||
Gam_PutParamMatchCod (Match->MchCod); // Current match being played
|
||||
Gam_PutParamQstInd (Match->Status.QstInd); // Current question index shown
|
||||
Par_PutHiddenParamUnsigned ("Ans",Index); // Index for this option
|
||||
fprintf (Gbl.F.Out,"<button type=\"submit\""
|
||||
" class=\"GAM_PLAY_STD_BUTTON BT_%c\">"
|
||||
"%c"
|
||||
"</div>"
|
||||
"</td>",
|
||||
"</button>",
|
||||
'A' + (char) NumOpt,
|
||||
'a' + (char) NumOpt);
|
||||
Frm_EndForm ();
|
||||
|
||||
/* End table cell */
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** End row *****/
|
||||
// if (NumOpt % 2 == 1)
|
||||
fprintf (Gbl.F.Out,"</tr>");
|
||||
}
|
||||
|
@ -3691,44 +3737,31 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Receive answers of a game ************************/
|
||||
/********* Receive question answer from student when playing a match *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Gam_ReceiveGameAnswers (void)
|
||||
void Gam_ReceiveQstAnsFromStd (void)
|
||||
{
|
||||
extern const char *Txt_You_already_played_this_game_before;
|
||||
extern const char *Txt_Thanks_for_playing_the_game;
|
||||
struct Game Game;
|
||||
struct Match Match;
|
||||
|
||||
/***** Get game code *****/
|
||||
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||
/***** Get match code *****/
|
||||
if ((Match.MchCod = Gam_GetParamMatchCod ()) == -1L)
|
||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
||||
|
||||
/***** Get data of the game from database *****/
|
||||
Gam_GetDataOfGameByCod (&Game);
|
||||
/***** Get data of the match from database *****/
|
||||
Gam_GetDataOfMatchByCod (&Match);
|
||||
|
||||
/***** Check if I have no answered this game formerly *****/
|
||||
if (Game.Status.IHaveAnswered)
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_You_already_played_this_game_before);
|
||||
else
|
||||
{
|
||||
/***** Receive and store user's answers *****/
|
||||
Gam_ReceiveAndStoreUserAnswersToAGame (Game.GamCod);
|
||||
/***** Receive and store user's answer *****/
|
||||
Gam_ReceiveAndStoreStdAnswerToQst (&Match);
|
||||
Ale_ShowAlert (Ale_INFO,Txt_Thanks_for_playing_the_game);
|
||||
}
|
||||
|
||||
/***** Show current game *****/
|
||||
Gam_ShowOneGame (Game.GamCod,
|
||||
true, // Show only this game
|
||||
true, // List game questions
|
||||
false); // Do not put form to start new match
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Get and store user's answers to a game *******************/
|
||||
/************* Get and store user's answer to a match question ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod)
|
||||
static void Gam_ReceiveAndStoreStdAnswerToQst (struct Match *Match)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
@ -3741,11 +3774,17 @@ static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod)
|
|||
char UnsignedStr[10 + 1];
|
||||
unsigned AnsInd;
|
||||
|
||||
/***** Get questions of this game from database *****/
|
||||
/***** Get question index from form *****/
|
||||
|
||||
|
||||
/***** Check that question index is the current one being played *****/
|
||||
|
||||
|
||||
/***** Get question of this game from database *****/
|
||||
NumQsts = (unsigned) DB_QuerySELECT (&mysql_res,"can not get questions of a game",
|
||||
"SELECT QstCod FROM gam_questions"
|
||||
" WHERE GamCod=%ld ORDER BY QstCod",
|
||||
GamCod);
|
||||
Match->GamCod);
|
||||
if (NumQsts) // The game has questions
|
||||
{
|
||||
/***** Get questions *****/
|
||||
|
@ -3784,7 +3823,7 @@ static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod)
|
|||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Register that you have answered this game *****/
|
||||
Gam_RegisterIHaveAnsweredGame (GamCod);
|
||||
// Gam_RegisterIHaveAnsweredGame (GamCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -3804,7 +3843,7 @@ static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
|
|||
/*****************************************************************************/
|
||||
/******************* Register that I have answered a game ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
static void Gam_RegisterIHaveAnsweredGame (long GamCod)
|
||||
{
|
||||
DB_QueryINSERT ("can not register that you have answered the game",
|
||||
|
@ -3814,7 +3853,7 @@ static void Gam_RegisterIHaveAnsweredGame (long GamCod)
|
|||
" (%ld,%ld)",
|
||||
GamCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/******************** Check if I have answered a game ************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -123,7 +123,7 @@ void Gam_RemoveMatch (void);
|
|||
void Gam_RequestNewMatch (void);
|
||||
// void Gam_PlayMatchStd (void);
|
||||
|
||||
void Gam_ReceiveGameAnswers (void);
|
||||
void Gam_ReceiveQstAnsFromStd (void);
|
||||
void Gam_CreateNewMatch (void);
|
||||
void Gam_ResumeUnfinishedMatch (void);
|
||||
void Gam_NextStatusMatch (void);
|
||||
|
|
|
@ -53741,7 +53741,7 @@ const char *Txt_You_already_answered_this_survey_before =
|
|||
#elif L==9 // pt
|
||||
"Você já respondeu a esso inquérito antes.";
|
||||
#endif
|
||||
|
||||
/*
|
||||
const char *Txt_You_already_played_this_game_before =
|
||||
#if L==1 // ca
|
||||
"Vostè ja ha jugat aquest joc abans.";
|
||||
|
@ -53762,7 +53762,7 @@ const char *Txt_You_already_played_this_game_before =
|
|||
#elif L==9 // pt
|
||||
"Você já jogou este jogo antes.";
|
||||
#endif
|
||||
|
||||
*/
|
||||
const char *Txt_You_are_now_LOGGED_IN_as_X = // Warning: it is very important to include two %s in the following sentences
|
||||
#if L==1 // ca
|
||||
"Vostè està ara %s com a <strong>%s</strong>.";
|
||||
|
|
Loading…
Reference in New Issue
Block a user