diff --git a/swad_action.c b/swad_action.c
index 32fb30af8..4a337fe03 100644
--- a/swad_action.c
+++ b/swad_action.c
@@ -502,7 +502,7 @@ Assessment:
NEW. ActRstGam Reset answers of game
NEW. ActHidGam Hide game
NEW. ActShoGam Show game
- NEW. ActEdiOneGamQst Edit a new question for a game
+ NEW. ActAddOneGamQst Add a new question to a game
NEW. ActGamLstTstQst List test questions to select one or several questions
NEW. ActAddTstQstToGam Add selected test questions to game
NEW. ActReqRemGamQst Request the removal of a question of a game
@@ -1979,7 +1979,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActRstGam */{1659,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_ResetGame ,NULL},
/* ActHidGam */{1660,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_HideGame ,NULL},
/* ActShoGam */{1661,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_UnhideGame ,NULL},
- /* ActEdiOneGamQst */{1662,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_RequestEditQuestion ,NULL},
+ /* ActAddOneGamQst */{1662,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_RequestNewQuestion ,NULL},
/* ActGamLstTstQst */{1666,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Tst_ListQuestionsToSelect ,NULL},
/* ActAddTstQstToGam */{1667,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_AddTstQuestionsToGame ,NULL},
/* ActReqRemGamQst */{1664,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_RequestRemoveQst ,NULL},
@@ -4705,7 +4705,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActRstGam, // #1659
ActHidGam, // #1660
ActShoGam, // #1661
- ActEdiOneGamQst, // #1662
+ ActAddOneGamQst, // #1662
-1, // #1663 (obsolete action)
ActReqRemGamQst, // #1664
ActRemGamQst, // #1665
diff --git a/swad_action.h b/swad_action.h
index 9a5616fec..870345cbf 100644
--- a/swad_action.h
+++ b/swad_action.h
@@ -514,7 +514,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActRstGam (ActChgCalCrs1stDay + 74)
#define ActHidGam (ActChgCalCrs1stDay + 75)
#define ActShoGam (ActChgCalCrs1stDay + 76)
-#define ActEdiOneGamQst (ActChgCalCrs1stDay + 77)
+#define ActAddOneGamQst (ActChgCalCrs1stDay + 77)
#define ActGamLstTstQst (ActChgCalCrs1stDay + 78)
#define ActAddTstQstToGam (ActChgCalCrs1stDay + 79)
#define ActReqRemGamQst (ActChgCalCrs1stDay + 80)
diff --git a/swad_changelog.h b/swad_changelog.h
index 504bbda64..52771fc7a 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -238,13 +238,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 16.251.10 (2017-09-06)"
+#define Log_PLATFORM_VERSION "SWAD 16.251.11 (2017-09-06)"
#define CSS_FILE "swad16.251.8.css"
#define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
+ Version 16.251.11:Sep 07, 2017 Listing games for remote control. Not finished. (226868 lines)
Version 16.251.10:Sep 06, 2017 Listing games for remote control. Not finished. (226913 lines)
2 changes necessary in database:
DROP TABLE IF EXISTS gam_answers;
diff --git a/swad_remote_control.c b/swad_remote_control.c
index e6aee10bf..7a8930a7e 100644
--- a/swad_remote_control.c
+++ b/swad_remote_control.c
@@ -66,19 +66,6 @@ const char *Rmt_StrAnswerTypesDB[Rmt_NUM_ANS_TYPES] =
#define Rmt_MAX_ANSWERS_PER_QUESTION 10
-struct GameQuestion
- {
- long QstCod;
- unsigned QstInd;
- Rmt_AnswerType_t AnswerType;
- struct
- {
- char *Text;
- } AnsChoice[Rmt_MAX_ANSWERS_PER_QUESTION];
- bool AllAnsTypes;
- char ListAnsTypes[Rmt_MAX_BYTES_LIST_ANSWER_TYPES + 1];
- };
-
#define Rmt_MAX_SELECTED_QUESTIONS 1000
#define Rmt_MAX_BYTES_LIST_SELECTED_QUESTIONS (Rmt_MAX_SELECTED_QUESTIONS * (1 + 10 + 1))
@@ -94,7 +81,7 @@ struct GameQuestion
/***************************** Private prototypes ****************************/
/*****************************************************************************/
-static void Rmt_ListAllGames (struct GameQuestion *GameQst);
+static void Rmt_ListAllGames (void);
static bool Rmt_CheckIfICanCreateGame (void);
static void Rmt_PutIconsListGames (void);
static void Rmt_PutIconToCreateNewGame (void);
@@ -102,8 +89,7 @@ static void Rmt_PutButtonToCreateNewGame (void);
static void Rmt_PutParamsToCreateNewGame (void);
static void Rmt_PutFormToSelectWhichGroupsToShow (void);
static void Rmt_ParamsWhichGroupsToShow (void);
-static void Rmt_ShowOneGame (long GamCod,struct GameQuestion *GameQst,
- bool ShowOnlyThisGameComplete);
+static void Rmt_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete);
static void Rmt_WriteAuthor (struct Game *Game);
static void Rmt_WriteStatus (struct Game *Game);
static void Rmt_GetParamGameOrder (void);
@@ -132,16 +118,14 @@ static void Rmt_GetAndWriteNamesOfGrpsAssociatedToGame (struct Game *Game);
static bool Rmt_CheckIfICanDoThisGameBasedOnGrps (long GamCod);
static unsigned Rmt_GetNumQstsGame (long GamCod);
-static void Rmt_InitQst (struct GameQuestion *GameQst);
static void Rmt_PutParamQstCod (long QstCod);
static long Rmt_GetParamQstCod (void);
static void Rmt_RemAnswersOfAQuestion (long QstCod);
static unsigned Rmt_GetQstIndFromQstCod (long QstCod);
static unsigned Rmt_GetNextQuestionIndexInGame (long GamCod);
-static void Rmt_ListGameQuestions (struct Game *Game,struct GameQuestion *GameQst);
+static void Rmt_ListGameQuestions (struct Game *Game);
static void Rmt_ListOneOrMoreQuestionsForEdition (struct Game *Game,
- struct GameQuestion *GameQst,
unsigned NumQsts,
MYSQL_RES *mysql_res);
static void Rmt_PutIconToAddNewQuestions (void);
@@ -169,22 +153,20 @@ static unsigned Rmt_GetNumUsrsWhoHaveAnsweredGame (long GamCod);
void Rmt_SeeAllGames (void)
{
- struct GameQuestion GameQst;
-
/***** Get parameters *****/
Rmt_GetParamGameOrder ();
Grp_GetParamWhichGrps ();
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
/***** Show all the games *****/
- Rmt_ListAllGames (&GameQst);
+ Rmt_ListAllGames ();
}
/*****************************************************************************/
/*************************** Show all the games ****************************/
/*****************************************************************************/
-static void Rmt_ListAllGames (struct GameQuestion *GameQst)
+static void Rmt_ListAllGames (void)
{
extern const char *Hlp_ASSESSMENT_Games;
extern const char *Txt_Games;
@@ -266,7 +248,7 @@ static void Rmt_ListAllGames (struct GameQuestion *GameQst)
for (NumGame = Pagination.FirstItemVisible;
NumGame <= Pagination.LastItemVisible;
NumGame++)
- Rmt_ShowOneGame (Gbl.Games.LstGamCods[NumGame - 1],GameQst,false);
+ Rmt_ShowOneGame (Gbl.Games.LstGamCods[NumGame - 1],false);
/***** End table *****/
Tbl_EndTable ();
@@ -393,10 +375,6 @@ static void Rmt_ParamsWhichGroupsToShow (void)
void Rmt_SeeOneGame (void)
{
struct Game Game;
- struct GameQuestion GameQst;
-
- /***** Initialize question to zero *****/
- Rmt_InitQst (&GameQst);
/***** Get parameters *****/
Rmt_GetParamGameOrder ();
@@ -408,15 +386,14 @@ void Rmt_SeeOneGame (void)
Lay_ShowErrorAndExit ("Code of game is missing.");
/***** Show game *****/
- Rmt_ShowOneGame (Game.GamCod,&GameQst,true);
+ Rmt_ShowOneGame (Game.GamCod,true);
}
/*****************************************************************************/
/****************************** Show one game ******************************/
/*****************************************************************************/
-static void Rmt_ShowOneGame (long GamCod,struct GameQuestion *GameQst,
- bool ShowOnlyThisGameComplete)
+static void Rmt_ShowOneGame (long GamCod,bool ShowOnlyThisGameComplete)
{
extern const char *Hlp_ASSESSMENT_Games;
extern const char *Txt_Game;
@@ -660,7 +637,7 @@ static void Rmt_ShowOneGame (long GamCod,struct GameQuestion *GameQst,
{
fprintf (Gbl.F.Out,"
"
"");
- Rmt_ListGameQuestions (&Game,GameQst);
+ Rmt_ListGameQuestions (&Game);
fprintf (Gbl.F.Out," | "
"
");
}
@@ -1485,7 +1462,6 @@ void Rmt_AskRemGame (void)
extern const char *Txt_Do_you_really_want_to_remove_the_game_X;
extern const char *Txt_Remove_game;
struct Game Game;
- struct GameQuestion GameQst;
/***** Get parameters *****/
Rmt_GetParamGameOrder ();
@@ -1510,7 +1486,7 @@ void Rmt_AskRemGame (void)
Btn_REMOVE_BUTTON,Txt_Remove_game);
/***** Show games again *****/
- Rmt_ListAllGames (&GameQst);
+ Rmt_ListAllGames ();
}
/*****************************************************************************/
@@ -1522,7 +1498,6 @@ void Rmt_RemoveGame (void)
extern const char *Txt_Game_X_removed;
char Query[512];
struct Game Game;
- struct GameQuestion GameQst;
/***** Get game code *****/
if ((Game.GamCod = Rmt_GetParamGameCod ()) == -1L)
@@ -1561,7 +1536,7 @@ void Rmt_RemoveGame (void)
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
/***** Show games again *****/
- Rmt_ListAllGames (&GameQst);
+ Rmt_ListAllGames ();
}
/*****************************************************************************/
@@ -1572,7 +1547,6 @@ void Rmt_AskResetGame (void)
{
extern const char *Txt_Do_you_really_want_to_reset_the_game_X;
struct Game Game;
- struct GameQuestion GameQst;
/***** Get parameters *****/
Rmt_GetParamGameOrder ();
@@ -1598,7 +1572,7 @@ void Rmt_AskResetGame (void)
Rmt_PutButtonToResetGame ();
/***** Show games again *****/
- Rmt_ListAllGames (&GameQst);
+ Rmt_ListAllGames ();
}
/*****************************************************************************/
@@ -1624,7 +1598,6 @@ void Rmt_ResetGame (void)
extern const char *Txt_Game_X_reset;
char Query[512];
struct Game Game;
- struct GameQuestion GameQst;
/***** Get game code *****/
if ((Game.GamCod = Rmt_GetParamGameCod ()) == -1L)
@@ -1653,7 +1626,7 @@ void Rmt_ResetGame (void)
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
/***** Show games again *****/
- Rmt_ListAllGames (&GameQst);
+ Rmt_ListAllGames ();
}
/*****************************************************************************/
@@ -1665,7 +1638,6 @@ void Rmt_HideGame (void)
extern const char *Txt_Game_X_is_now_hidden;
char Query[128];
struct Game Game;
- struct GameQuestion GameQst;
/***** Get game code *****/
if ((Game.GamCod = Rmt_GetParamGameCod ()) == -1L)
@@ -1687,7 +1659,7 @@ void Rmt_HideGame (void)
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
/***** Show games again *****/
- Rmt_ListAllGames (&GameQst);
+ Rmt_ListAllGames ();
}
/*****************************************************************************/
@@ -1699,7 +1671,6 @@ void Rmt_UnhideGame (void)
extern const char *Txt_Game_X_is_now_visible;
char Query[128];
struct Game Game;
- struct GameQuestion GameQst;
/***** Get game code *****/
if ((Game.GamCod = Rmt_GetParamGameCod ()) == -1L)
@@ -1721,7 +1692,7 @@ void Rmt_UnhideGame (void)
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
/***** Show games again *****/
- Rmt_ListAllGames (&GameQst);
+ Rmt_ListAllGames ();
}
/*****************************************************************************/
@@ -1760,7 +1731,6 @@ void Rmt_RequestCreatOrEditGame (void)
extern const char *Txt_Create_game;
extern const char *Txt_Save;
struct Game Game;
- struct GameQuestion GameQst;
bool ItsANewGame;
char Txt[Cns_MAX_BYTES_TEXT + 1];
@@ -1899,7 +1869,7 @@ void Rmt_RequestCreatOrEditGame (void)
/***** Show questions of the game ready to be edited *****/
if (!ItsANewGame)
- Rmt_ListGameQuestions (&Game,&GameQst);
+ Rmt_ListGameQuestions (&Game);
}
/*****************************************************************************/
@@ -2062,7 +2032,6 @@ void Rmt_RecFormGame (void)
extern const char *Txt_You_must_specify_the_title_of_the_game;
struct Game OldGame;
struct Game NewGame;
- struct GameQuestion GameQst;
bool ItsANewGame;
bool NewGameIsCorrect = true;
unsigned NumUsrsToBeNotifiedByEMail;
@@ -2193,7 +2162,7 @@ void Rmt_RecFormGame (void)
Rmt_UpdateNumUsrsNotifiedByEMailAboutGame (NewGame.GamCod,NumUsrsToBeNotifiedByEMail);
/***** Show games again *****/
- Rmt_ListAllGames (&GameQst);
+ Rmt_ListAllGames ();
}
/*****************************************************************************/
@@ -2545,21 +2514,14 @@ static unsigned Rmt_GetNumQstsGame (long GamCod)
/*********** Put a form to edit/create a question in game *****************/
/*****************************************************************************/
-void Rmt_RequestEditQuestion (void)
+void Rmt_RequestNewQuestion (void)
{
struct Game Game;
- struct GameQuestion GameQst;
-
- /***** Initialize question to zero *****/
- Rmt_InitQst (&GameQst);
/***** Get game code *****/
if ((Game.GamCod = Rmt_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
- /* Get the question code */
- GameQst.QstCod = Rmt_GetParamQstCod ();
-
/***** Get other parameters *****/
Rmt_GetParamGameOrder ();
Grp_GetParamWhichGrps ();
@@ -2569,24 +2531,7 @@ void Rmt_RequestEditQuestion (void)
Tst_ShowFormAskSelectTstsForGame (Game.GamCod);
/***** Show current game *****/
- Rmt_ShowOneGame (Game.GamCod,&GameQst,true);
- }
-
-/*****************************************************************************/
-/********************* Initialize a new question to zero *********************/
-/*****************************************************************************/
-
-static void Rmt_InitQst (struct GameQuestion *GameQst)
- {
- unsigned NumAns;
-
- GameQst->QstCod = -1L;
- GameQst->QstInd = 0;
- GameQst->AnswerType = Rmt_ANS_UNIQUE_CHOICE;
- for (NumAns = 0;
- NumAns < Rmt_MAX_ANSWERS_PER_QUESTION;
- NumAns++)
- GameQst->AnsChoice[NumAns].Text = NULL;
+ Rmt_ShowOneGame (Game.GamCod,true);
}
/*****************************************************************************/
@@ -2688,7 +2633,7 @@ static unsigned Rmt_GetNextQuestionIndexInGame (long GamCod)
/************************ List the questions of a game ***********************/
/*****************************************************************************/
-static void Rmt_ListGameQuestions (struct Game *Game,struct GameQuestion *GameQst)
+static void Rmt_ListGameQuestions (struct Game *Game)
{
extern const char *Hlp_ASSESSMENT_Games_questions;
extern const char *Txt_Questions;
@@ -2698,7 +2643,7 @@ static void Rmt_ListGameQuestions (struct Game *Game,struct GameQuestion *GameQs
MYSQL_RES *mysql_res;
unsigned NumQsts;
bool Editing = (Gbl.Action.Act == ActEdiOneGam ||
- Gbl.Action.Act == ActEdiOneGamQst);
+ Gbl.Action.Act == ActAddOneGamQst);
Tst_ActionToDoWithQuestions_t ActionToDoWithQuestions;
/***** How to show the questions ******/
@@ -2740,8 +2685,7 @@ static void Rmt_ListGameQuestions (struct Game *Game,struct GameQuestion *GameQs
if (NumQsts)
{
/***** Show the table with the questions *****/
- Rmt_ListOneOrMoreQuestionsForEdition (Game,GameQst,
- NumQsts,mysql_res);
+ Rmt_ListOneOrMoreQuestionsForEdition (Game,NumQsts,mysql_res);
if (ActionToDoWithQuestions == Tst_SHOW_GAME_TO_ANSWER)
{
@@ -2773,7 +2717,6 @@ static void Rmt_ListGameQuestions (struct Game *Game,struct GameQuestion *GameQs
/*****************************************************************************/
static void Rmt_ListOneOrMoreQuestionsForEdition (struct Game *Game,
- struct GameQuestion *GameQst,
unsigned NumQsts,
MYSQL_RES *mysql_res)
{
@@ -2787,6 +2730,7 @@ static void Rmt_ListOneOrMoreQuestionsForEdition (struct Game *Game,
unsigned NumQst;
MYSQL_ROW row;
unsigned UniqueId;
+ long QstCod;
/***** Write the heading *****/
Tbl_StartTableWideMargin (2);
@@ -2831,9 +2775,9 @@ static void Rmt_ListOneOrMoreQuestionsForEdition (struct Game *Game,
Tst_QstConstructor ();
/* row[0] holds the code of the question */
- if ((Gbl.Test.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
+ if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
Lay_ShowErrorAndExit ("Wrong code of question.");
- GameQst->QstCod = Gbl.Test.QstCod;
+ Gbl.Test.QstCod = QstCod;
/***** Icons *****/
fprintf (Gbl.F.Out,""
@@ -2842,13 +2786,13 @@ static void Rmt_ListOneOrMoreQuestionsForEdition (struct Game *Game,
/* Write icon to remove the question */
Act_FormStart (ActReqRemGamQst);
Rmt_PutParamGameCod (Game->GamCod);
- Rmt_PutParamQstCod (GameQst->QstCod);
+ Rmt_PutParamQstCod (QstCod);
Ico_PutIconRemove ();
Act_FormEnd ();
/* Write icon to edit the question */
Act_FormStart (ActEdiOneTstQst);
- Rmt_PutParamQstCod (GameQst->QstCod);
+ Rmt_PutParamQstCod (QstCod);
fprintf (Gbl.F.Out,"",
@@ -2893,7 +2837,7 @@ static void Rmt_ListOneOrMoreQuestionsForEdition (struct Game *Game,
"TEST_IMG_EDIT_LIST_STEM_CONTAINER",
"TEST_IMG_EDIT_LIST_STEM");
Tst_WriteQstFeedback (row[3],"TEST_EDI_LIGHT");
- Tst_WriteAnswersGameResult (Game,GameQst->QstInd,GameQst->QstCod);
+ Tst_WriteAnswersGameResult (Game,NumQst,QstCod);
fprintf (Gbl.F.Out,""
"
");
@@ -2906,7 +2850,7 @@ static void Rmt_ListOneOrMoreQuestionsForEdition (struct Game *Game,
Tbl_EndTable ();
/***** Button to add a new question *****/
- Tst_PutButtonToAddQuestion ();
+ Rmt_PutButtonToAddNewQuestions ();
/***** End box *****/
Box_EndBox ();
@@ -2921,7 +2865,7 @@ static void Rmt_PutIconToAddNewQuestions (void)
extern const char *Txt_Add_questions;
/***** Put form to create a new question *****/
- Lay_PutContextualLink (ActEdiOneGamQst,NULL,Rmt_PutParams,
+ Lay_PutContextualLink (ActAddOneGamQst,NULL,Rmt_PutParams,
"plus64x64.png",
Txt_Add_questions,NULL,
NULL);
@@ -2935,7 +2879,7 @@ static void Rmt_PutButtonToAddNewQuestions (void)
{
extern const char *Txt_Add_questions;
- Act_FormStart (ActEdiOneGamQst);
+ Act_FormStart (ActAddOneGamQst);
Rmt_PutParams ();
Btn_PutConfirmButton (Txt_Add_questions);
Act_FormEnd ();
@@ -2951,7 +2895,8 @@ void Rmt_AddTstQuestionsToGame (void)
struct Game Game;
const char *Ptr;
char LongStr[1 + 10 + 1];
- struct GameQuestion GameQst;
+ long QstCod;
+ unsigned QstInd;
char Query[256];
/***** Get game code *****/
@@ -2980,23 +2925,25 @@ void Rmt_AddTstQuestionsToGame (void)
{
/* Get next code */
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,1 + 10);
- if (sscanf (LongStr,"%ld",&GameQst.QstCod) != 1)
+ if (sscanf (LongStr,"%ld",&QstCod) != 1)
Lay_ShowErrorAndExit ("Wrong question code.");
/* Get next index */
- GameQst.QstInd = Rmt_GetNextQuestionIndexInGame (Game.GamCod);
+ QstInd = Rmt_GetNextQuestionIndexInGame (Game.GamCod);
/* Insert question in the table of questions */
sprintf (Query,"INSERT INTO gam_questions"
" (GamCod,QstCod,QstInd)"
" VALUES"
" (%ld,%ld,%u)",
- Game.GamCod,GameQst.QstCod,GameQst.QstInd);
+ Game.GamCod,QstCod,QstInd);
DB_QueryINSERT (Query,"can not create question");
}
/***** Free space for selected question codes *****/
Rmt_FreeListsSelectedQuestions ();
+
+ /***** Show game again *****/
}
/*****************************************************************************/
@@ -3162,7 +3109,8 @@ void Rmt_RequestRemoveQst (void)
extern const char *Txt_Do_you_really_want_to_remove_the_question_X;
extern const char *Txt_Remove_question;
struct Game Game;
- struct GameQuestion GameQst;
+ long QstCod;
+ unsigned QstInd;
/***** Get parameters from form *****/
/* Get game code */
@@ -3170,23 +3118,23 @@ void Rmt_RequestRemoveQst (void)
Lay_ShowErrorAndExit ("Code of game is missing.");
/* Get question code */
- if ((GameQst.QstCod = Rmt_GetParamQstCod ()) < 0)
+ if ((QstCod = Rmt_GetParamQstCod ()) < 0)
Lay_ShowErrorAndExit ("Wrong code of question.");
/* Get question index */
- GameQst.QstInd = Rmt_GetQstIndFromQstCod (GameQst.QstCod);
+ QstInd = Rmt_GetQstIndFromQstCod (QstCod);
/***** Show question and button to remove question *****/
Gbl.Games.CurrentGamCod = Game.GamCod;
- Gbl.Games.CurrentQstCod = GameQst.QstCod;
+ Gbl.Games.CurrentQstCod = QstCod;
sprintf (Gbl.Alert.Txt,Txt_Do_you_really_want_to_remove_the_question_X,
- (unsigned long) (GameQst.QstInd + 1));
+ (unsigned long) (QstInd + 1));
Ale_ShowAlertAndButton (Ale_QUESTION,Gbl.Alert.Txt,
ActRemGamQst,NULL,NULL,Rmt_PutParamsRemoveOneQst,
Btn_REMOVE_BUTTON,Txt_Remove_question);
/***** Show current game *****/
- Rmt_ShowOneGame (Game.GamCod,&GameQst,true);
+ Rmt_ShowOneGame (Game.GamCod,true);
}
/*****************************************************************************/
@@ -3198,7 +3146,8 @@ void Rmt_RemoveQst (void)
extern const char *Txt_Question_removed;
char Query[512];
struct Game Game;
- struct GameQuestion GameQst;
+ long QstCod;
+ unsigned QstInd;
/***** Get parameters from form *****/
/* Get game code */
@@ -3206,19 +3155,19 @@ void Rmt_RemoveQst (void)
Lay_ShowErrorAndExit ("Code of game is missing.");
/* Get question code */
- if ((GameQst.QstCod = Rmt_GetParamQstCod ()) < 0)
+ if ((QstCod = Rmt_GetParamQstCod ()) < 0)
Lay_ShowErrorAndExit ("Wrong code of question.");
/* Get question index */
- GameQst.QstInd = Rmt_GetQstIndFromQstCod (GameQst.QstCod);
+ QstInd = Rmt_GetQstIndFromQstCod (QstCod);
/***** Remove the question from all the tables *****/
/* Remove answers from this test question */
- Rmt_RemAnswersOfAQuestion (GameQst.QstCod);
+ Rmt_RemAnswersOfAQuestion (QstCod);
/* Remove the question itself */
sprintf (Query,"DELETE FROM gam_questions WHERE QstCod=%ld",
- GameQst.QstCod);
+ QstCod);
DB_QueryDELETE (Query,"can not remove a question");
if (!mysql_affected_rows (&Gbl.mysql))
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
@@ -3226,7 +3175,7 @@ void Rmt_RemoveQst (void)
/* Change index of questions greater than this */
sprintf (Query,"UPDATE gam_questions SET QstInd=QstInd-1"
" WHERE GamCod=%ld AND QstInd>%u",
- Game.GamCod,GameQst.QstInd);
+ Game.GamCod,QstInd);
DB_QueryUPDATE (Query,"can not update indexes of questions");
/***** Write message *****/
@@ -3234,7 +3183,7 @@ void Rmt_RemoveQst (void)
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
/***** Show current game *****/
- Rmt_ShowOneGame (Game.GamCod,&GameQst,true);
+ Rmt_ShowOneGame (Game.GamCod,true);
}
/*****************************************************************************/
@@ -3246,7 +3195,6 @@ void Rmt_ReceiveGameAnswers (void)
extern const char *Txt_You_already_played_this_game_before;
extern const char *Txt_Thanks_for_playing_the_game;
struct Game Game;
- struct GameQuestion GameQst;
/***** Get game code *****/
if ((Game.GamCod = Rmt_GetParamGameCod ()) == -1L)
@@ -3266,7 +3214,7 @@ void Rmt_ReceiveGameAnswers (void)
}
/***** Show current game *****/
- Rmt_ShowOneGame (Game.GamCod,&GameQst,true);
+ Rmt_ShowOneGame (Game.GamCod,true);
}
/*****************************************************************************/
@@ -3282,7 +3230,7 @@ static void Rmt_ReceiveAndStoreUserAnswersToAGame (long GamCod)
unsigned NumQsts;
long QstCod;
char ParamName[3 + 10 + 6 + 1];
- char StrAnswersIndexes[Rmt_MAX_ANSWERS_PER_QUESTION * (10 + 1)];
+ char StrAnswersIndexes[Tst_MAX_OPTIONS_PER_QUESTION * (10 + 1)];
const char *Ptr;
char UnsignedStr[10 + 1];
unsigned AnsInd;
diff --git a/swad_remote_control.h b/swad_remote_control.h
index f65cfeb5b..161ad2f00 100644
--- a/swad_remote_control.h
+++ b/swad_remote_control.h
@@ -110,8 +110,7 @@ void Rmt_RemoveGroup (long GrpCod);
void Rmt_RemoveGroupsOfType (long GrpTypCod);
void Rmt_RemoveGames (Sco_Scope_t Scope,long Cod);
-void Rmt_RequestEditQuestion (void);
-// void Rmt_ReceiveQst (void);
+void Rmt_RequestNewQuestion (void);
void Rmt_GetAndDrawBarNumUsrsWhoAnswered (struct Game *Game,long QstCod,unsigned AnsInd);
diff --git a/swad_test.c b/swad_test.c
index eef7aaffd..65a208585 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -164,6 +164,8 @@ static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst);
static void Tst_UpdateLastAccTst (void);
static bool Tst_CheckIfICanEditTests (void);
static void Tst_PutIconsTests (void);
+static void Tst_PutButtonToAddQuestion (void);
+
static long Tst_GetParamTagCode (void);
static bool Tst_CheckIfCurrentCrsHasTestTags (void);
static unsigned long Tst_GetAllTagsFromCurrentCrs (MYSQL_RES **mysql_res);
@@ -1446,7 +1448,7 @@ static void Tst_PutIconsTests (void)
/**************** Put button to create a new test question *******************/
/*****************************************************************************/
-void Tst_PutButtonToAddQuestion (void)
+static void Tst_PutButtonToAddQuestion (void)
{
extern const char *Txt_New_question;
diff --git a/swad_test.h b/swad_test.h
index a67690f62..7c55100b5 100644
--- a/swad_test.h
+++ b/swad_test.h
@@ -56,7 +56,6 @@
#define Tst_MAX_BYTES_ANSWER_TYPE 32
-
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
@@ -166,7 +165,6 @@ void Tst_CheckIfNumberOfAnswersIsOne (void);
unsigned long Tst_GetTagsQst (long QstCod,MYSQL_RES **mysql_res);
void Tst_GetAndWriteTagsQst (long QstCod);
-void Tst_PutButtonToAddQuestion (void);
void Tst_ShowFormConfig (void);
void Tst_EnableTag (void);
void Tst_DisableTag (void);