diff --git a/swad_changelog.h b/swad_changelog.h
index 0536a1338..e936b1fe4 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -464,6 +464,8 @@ https://oficinavirtual.ugr.es/awc/horario/ve_horario/visor.jsp?programa=M37156&s
contiene una de las que yo imparto. Así que me imagino que te esperarás la sugerencia (petición con café o cerveza como recompensa): ¿sería posible que en la pestaña de horario se pudiese embeber esa página? (Creo que los grados usan algo parecido también.)
*/
+// TODO: En resultados de test y de juegos, en preguntas modificadas se podría mostrar la puntuación obtenida en la pregunta (ahora no sale)
+// TODO: Al crear un nuevo juego, debería irse a la pantalla de añadir preguntas (la misma opción que sale cuando pulsas en editar un juego existente)
/*****************************************************************************/
/****************************** Public constants *****************************/
@@ -483,12 +485,13 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 19.30.1 (2019-10-01)"
+#define Log_PLATFORM_VERSION "SWAD 19.30.2 (2019-10-03)"
#define CSS_FILE "swad19.29.css"
#define JS_FILE "swad19.30.js"
/*
// TODO: Perico: poner un candado de bloqueo de creación/edición de proyectos (por ejemplo en asignaturas obsoletas)
+ Version 19.30.2: Oct 03, 2019 Changes in edition of games. (246914 lines)
Version 19.30.1: Oct 01, 2019 Changes in match playing. (246904 lines)
Version 19.30: Oct 01, 2019 The match refreshment time for teachers is now different from the time for students.
Code refactoring in matchs.
diff --git a/swad_game.c b/swad_game.c
index 5ca293bb2..0e6fe16e9 100644
--- a/swad_game.c
+++ b/swad_game.c
@@ -106,6 +106,8 @@ static void Gam_RemoveGameFromAllTables (long GamCod);
static bool Gam_CheckIfSimilarGameExists (struct Game *Game);
+static void Gam_PutFormsEditionGame (struct Game *Game,bool ItsANewGame);
+
static void Gam_CreateGame (struct Game *Game,const char *Txt);
static void Gam_UpdateGame (struct Game *Game,const char *Txt);
@@ -1064,10 +1066,34 @@ static bool Gam_CheckIfSimilarGameExists (struct Game *Game)
}
/*****************************************************************************/
-/*********************** Put a form to create a new game *********************/
+/**************** Request the creation or edition of a game ******************/
/*****************************************************************************/
void Gam_RequestCreatOrEditGame (void)
+ {
+ struct Game Game;
+ bool ItsANewGame;
+
+ /***** Check if I can create new games *****/
+ if (!Gam_CheckIfICanEditGames ())
+ Act_NoPermissionExit ();
+
+ /***** Get parameters *****/
+ Game.GamCod = Gam_GetParams ();
+ ItsANewGame = (Game.GamCod < 0);
+
+ /***** Put forms to create/edit a game *****/
+ Gam_PutFormsEditionGame (&Game,ItsANewGame);
+
+ /***** Show games again *****/
+ Gam_ListAllGames ();
+ }
+
+/*****************************************************************************/
+/********************* Put a form to create/edit a game **********************/
+/*****************************************************************************/
+
+static void Gam_PutFormsEditionGame (struct Game *Game,bool ItsANewGame)
{
extern const char *Hlp_ASSESSMENT_Games_new_game;
extern const char *Hlp_ASSESSMENT_Games_edit_game;
@@ -1078,37 +1104,21 @@ void Gam_RequestCreatOrEditGame (void)
extern const char *Txt_Description;
extern const char *Txt_Create_game;
extern const char *Txt_Save_changes;
- struct Game Game;
- bool ItsANewGame;
char Txt[Cns_MAX_BYTES_TEXT + 1];
- /***** Get parameters *****/
- Game.GamCod = Gam_GetParams ();
-
- /***** Get from the database the data of the game *****/
- ItsANewGame = (Game.GamCod < 0);
+ /***** Get game data *****/
if (ItsANewGame)
- {
- /***** Put link (form) to create new game *****/
- if (!Gam_CheckIfICanEditGames ())
- Act_NoPermissionExit ();
-
/* Initialize to empty game */
- Gam_ResetGame (&Game);
- }
+ Gam_ResetGame (Game);
else
{
- /* Get data of the game from database */
- Gam_GetDataOfGameByCod (&Game);
- if (!Gam_CheckIfICanEditGames ())
- Act_NoPermissionExit ();
-
- /* Get text of the game from database */
- Gam_GetGameTxtFromDB (Game.GamCod,Txt);
+ /* Get game data from database */
+ Gam_GetDataOfGameByCod (Game);
+ Gam_GetGameTxtFromDB (Game->GamCod,Txt);
}
/***** Start form *****/
- Gam_SetParamCurrentGamCod (Game.GamCod); // Used to pass parameter
+ Gam_SetParamCurrentGamCod (Game->GamCod); // Used to pass parameter
Frm_StartForm (ItsANewGame ? ActNewGam :
ActChgGam);
Gam_PutParams ();
@@ -1119,8 +1129,8 @@ void Gam_RequestCreatOrEditGame (void)
Hlp_ASSESSMENT_Games_new_game,Box_NOT_CLOSABLE,2);
else
Box_StartBoxTable (NULL,
- Game.Title[0] ? Game.Title :
- Txt_Edit_game,
+ Game->Title[0] ? Game->Title :
+ Txt_Edit_game,
NULL,
Hlp_ASSESSMENT_Games_edit_game,Box_NOT_CLOSABLE,2);
@@ -1137,7 +1147,7 @@ void Gam_RequestCreatOrEditGame (void)
"",
The_ClassFormInBox[Gbl.Prefs.Theme],
Txt_Title,
- Gam_MAX_CHARS_TITLE,Game.Title);
+ Gam_MAX_CHARS_TITLE,Game->Title);
/***** Game text *****/
fprintf (Gbl.F.Out,"
"
@@ -1166,7 +1176,7 @@ void Gam_RequestCreatOrEditGame (void)
/***** Show questions of the game ready to be edited *****/
if (!ItsANewGame)
- Gam_ListGameQuestions (&Game);
+ Gam_ListGameQuestions (Game);
}
/*****************************************************************************/
@@ -1232,6 +1242,9 @@ void Gam_RecFormGame (void)
}
else
Gam_RequestCreatOrEditGame ();
+
+ /***** Put forms to create/edit a game *****/
+ Gam_PutFormsEditionGame (&NewGame,false);
}
else
Act_NoPermissionExit ();
@@ -1575,16 +1588,15 @@ static void Gam_ListGameQuestions (struct Game *Game)
NULL,
Hlp_ASSESSMENT_Games_questions,Box_NOT_CLOSABLE);
+ /***** Show table with questions *****/
if (NumQsts)
- /***** Show the table with the questions *****/
Gam_ListOneOrMoreQuestionsForEdition (Game->GamCod,NumQsts,mysql_res,
ICanEditQuestions);
else // This game has no questions
Ale_ShowAlert (Ale_INFO,Txt_This_game_has_no_questions);
- if (ICanEditQuestions && // I can edit questions
- !NumQsts) // This game has no questions
- /***** Put button to add a new question in this game *****/
+ /***** Put button to add a new question in this game *****/
+ if (ICanEditQuestions) // I can edit questions
Gam_PutButtonToAddNewQuestions ();
/***** Free structure that stores the query result *****/
@@ -1808,7 +1820,7 @@ static void Gam_PutButtonToAddNewQuestions (void)
void Gam_AddTstQuestionsToGame (void)
{
- extern const char *Txt_You_must_select_one_ore_more_questions;
+ extern const char *Txt_No_questions_have_been_added;
struct Game Game;
const char *Ptr;
char LongStr[1 + 10 + 1];
@@ -1831,33 +1843,31 @@ void Gam_AddTstQuestionsToGame (void)
Gam_MAX_BYTES_LIST_SELECTED_QUESTIONS);
/* Check number of questions */
- if (Gam_CountNumQuestionsInList () == 0) // If no questions selected...
- { // ...write warning alert
- Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_questions);
-
- // TODO: Show form again!!!
- }
-
- /***** Insert questions in database *****/
- Ptr = Gbl.Games.ListQuestions;
- while (*Ptr)
+ if (Gam_CountNumQuestionsInList ()) // If questions selected...
{
- /* Get next code */
- Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,1 + 10);
- if (sscanf (LongStr,"%ld",&QstCod) != 1)
- Lay_ShowErrorAndExit ("Wrong question code.");
+ /***** Insert questions in database *****/
+ Ptr = Gbl.Games.ListQuestions;
+ while (*Ptr)
+ {
+ /* Get next code */
+ Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,1 + 10);
+ if (sscanf (LongStr,"%ld",&QstCod) != 1)
+ Lay_ShowErrorAndExit ("Wrong question code.");
- /* Get current maximum index */
- MaxQstInd = Gam_GetMaxQuestionIndexInGame (Game.GamCod); // -1 if no questions
+ /* Get current maximum index */
+ MaxQstInd = Gam_GetMaxQuestionIndexInGame (Game.GamCod); // -1 if no questions
- /* Insert question in the table of questions */
- DB_QueryINSERT ("can not create question",
- "INSERT INTO gam_questions"
- " (GamCod,QstCod,QstInd)"
- " VALUES"
- " (%ld,%ld,%u)",
- Game.GamCod,QstCod,MaxQstInd + 1);
+ /* Insert question in the table of questions */
+ DB_QueryINSERT ("can not create question",
+ "INSERT INTO gam_questions"
+ " (GamCod,QstCod,QstInd)"
+ " VALUES"
+ " (%ld,%ld,%u)",
+ Game.GamCod,QstCod,MaxQstInd + 1);
+ }
}
+ else
+ Ale_ShowAlert (Ale_WARNING,Txt_No_questions_have_been_added);
/***** Free space for selected question codes *****/
Gam_FreeListsSelectedQuestions ();
diff --git a/swad_text.c b/swad_text.c
index 2d1dd7d68..863b0ef91 100644
--- a/swad_text.c
+++ b/swad_text.c
@@ -25617,6 +25617,27 @@ const char *Txt_No_questions_found_matching_your_search_criteria =
"Não questões com os seus critérios de pesquisa selecionados.";
#endif
+const char *Txt_No_questions_have_been_added =
+#if L==1 // ca
+ "No s'ha afegit cap pregunta.";
+#elif L==2 // de
+ "Es wurden keine Fragen hinzugefügt.";
+#elif L==3 // en
+ "No questions have been added.";
+#elif L==4 // es
+ "No se ha añadido ninguna pregunta.";
+#elif L==5 // fr
+ "Aucune question n'a été ajoutée.";
+#elif L==6 // gn
+ "No se ha añadido ninguna pregunta."; // Okoteve traducción
+#elif L==7 // it
+ "Nessuna domanda è stata aggiunta.";
+#elif L==8 // pl
+ "Nie dodano żadnych pytań.";
+#elif L==9 // pt
+ "Nenhuma pergunta foi adicionada.";
+#endif
+
const char *Txt_No_results =
#if L==1 // ca
"No hi ha resultats.";
@@ -55857,27 +55878,6 @@ const char *Txt_You_must_select_a_T_F_answer =
"Você deve selecionar uma resposta V ou F.";
#endif
-const char *Txt_You_must_select_one_ore_more_questions =
-#if L==1 // ca
- "Heu de seleccionar una o més preguntes.";
-#elif L==2 // de
- "Sie müssen eine oder mehrere Fragen auswählen.";
-#elif L==3 // en
- "You must select one or more questions.";
-#elif L==4 // es
- "Debe seleccionar una o más preguntas.";
-#elif L==5 // fr
- "Vous devez sélectionner une ou plusieurs questions.";
-#elif L==6 // gn
- "Debe seleccionar una o más preguntas."; // Okoteve traducción
-#elif L==7 // it
- "Devi selezionare una o più domande.";
-#elif L==8 // pl
- "Musisz wybrać jedno lub więcej pytań.";
-#elif L==9 // pt
- "Você deve selecionar uma ou mais perguntas.";
-#endif
-
const char *Txt_You_must_select_one_ore_more_recipients =
#if L==1 // ca
"Debe seleccionar uno o más destinatarios."; // Necessita traduccio