diff --git a/swad_changelog.h b/swad_changelog.h index 9ae0bb5f5..8026ab479 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -544,10 +544,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.204.3 (2020-04-28)" +#define Log_PLATFORM_VERSION "SWAD 19.204.4 (2020-04-28)" #define CSS_FILE "swad19.193.1.css" #define JS_FILE "swad19.193.1.js" /* + Version 19.204.4: Apr 28, 2020 Fixed bug in creation of new exam. (300470 lines) Version 19.204.3: Apr 28, 2020 List updated exam events after creation. (300521 lines) Version 19.204.2: Apr 28, 2020 Changes in creation of exam events. (300503 lines) Version 19.204.1: Apr 28, 2020 Fixed problem in listing of set questions when questions have been removed. (300480 lines) diff --git a/swad_exam.c b/swad_exam.c index f05ede73e..4d8ea425b 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -1535,11 +1535,6 @@ void Exa_RequestCreatOrEditExam (void) /***** Put form to create/edit an exam and show sets *****/ Exa_PutFormsOneExam (&Exams,&Exam,&Set,ItsANewExam); - - /***** Show exams or questions *****/ - if (ItsANewExam) - /* Show exams again */ - Exa_ListAllExams (&Exams); } /*****************************************************************************/ @@ -1983,8 +1978,6 @@ void Exa_RecFormExam (void) /***** Get parameters *****/ Exa_GetParams (&Exams); - if (Exams.ExaCod <= 0) - Lay_WrongExamExit (); Exam.ExaCod = Exams.ExaCod; ItsANewExam = (Exam.ExaCod <= 0); @@ -2691,7 +2684,6 @@ static void ExaSet_ListExamSets (struct Exa_Exams *Exams, { extern const char *Hlp_ASSESSMENT_Exams_question_sets; extern const char *Txt_Sets_of_questions; - extern const char *Txt_This_exam_has_no_sets_of_questions; MYSQL_RES *mysql_res; unsigned MaxSetInd; unsigned NumSets; @@ -2724,8 +2716,6 @@ static void ExaSet_ListExamSets (struct Exa_Exams *Exams, MaxSetInd, NumSets,mysql_res, ICanEditSets); - else // This exam has no sets - Ale_ShowAlert (Ale_INFO,Txt_This_exam_has_no_sets_of_questions); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -2808,6 +2798,10 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, char *Anchor; char StrSetInd[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; + /***** Trivial check *****/ + if (!NumSets) + return; + /***** Write the heading *****/ HTM_TABLE_BeginWideMarginPadding (2); ExaSet_PutTableHeadingForSets (); @@ -3433,7 +3427,6 @@ void ExaSet_MoveUpSet (void) void ExaSet_MoveDownSet (void) { extern const char *Txt_Movement_not_allowed; - extern const char *Txt_This_exam_has_no_sets_of_questions; struct Exa_Exams Exams; struct Exa_Exam Exam; struct ExaSet_Set Set; @@ -3474,23 +3467,18 @@ void ExaSet_MoveDownSet (void) MaxSetInd = ExaSet_GetMaxSetIndexInExam (Exam.ExaCod); /***** Move down set *****/ - if (MaxSetInd) + if (SetIndTop < MaxSetInd) { - if (SetIndTop < MaxSetInd) - { - /* Indexes of sets to be exchanged */ - SetIndBottom = ExaSet_GetNextSetIndexInExam (Exam.ExaCod,SetIndTop); - if (!SetIndBottom) - Lay_ShowErrorAndExit ("Wrong index of set."); + /* Indexes of sets to be exchanged */ + SetIndBottom = ExaSet_GetNextSetIndexInExam (Exam.ExaCod,SetIndTop); + if (!SetIndBottom) + Lay_ShowErrorAndExit ("Wrong index of set."); - /* Exchange sets */ - ExaSet_ExchangeSets (Exam.ExaCod,SetIndTop,SetIndBottom); - } - else - Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed); + /* Exchange sets */ + ExaSet_ExchangeSets (Exam.ExaCod,SetIndTop,SetIndBottom); } else - Ale_ShowAlert (Ale_WARNING,Txt_This_exam_has_no_sets_of_questions); + Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed); /***** Show current exam and its sets *****/ Exa_PutFormsOneExam (&Exams,&Exam,&Set, diff --git a/swad_exam_event.c b/swad_exam_event.c index 97df7bc42..c00d062c7 100644 --- a/swad_exam_event.c +++ b/swad_exam_event.c @@ -490,6 +490,10 @@ static void ExaEvt_ListOneOrMoreEvents (struct Exa_Exams *Exams, struct ExaEvt_Event Event; bool ICanEditEvents = ExaEvt_CheckIfICanEditEvents (); + /***** Trivial check *****/ + if (!NumEvents) + return; + /***** Reset event *****/ ExaEvt_ResetEvent (&Event); diff --git a/swad_game.c b/swad_game.c index 6c194d4d5..c7ef62441 100644 --- a/swad_game.c +++ b/swad_game.c @@ -1929,7 +1929,6 @@ static void Gam_ListGameQuestions (struct Gam_Games *Games,struct Gam_Game *Game { extern const char *Hlp_ASSESSMENT_Games_questions; extern const char *Txt_Questions; - extern const char *Txt_This_game_has_no_questions; MYSQL_RES *mysql_res; unsigned NumQsts; bool ICanEditQuestions = Gam_CheckIfEditable (Game); @@ -1960,8 +1959,6 @@ static void Gam_ListGameQuestions (struct Gam_Games *Games,struct Gam_Game *Game Gam_ListOneOrMoreQuestionsForEdition (Games, Game->GamCod,NumQsts,mysql_res, ICanEditQuestions); - else // This game has no questions - Ale_ShowAlert (Ale_INFO,Txt_This_game_has_no_questions); /***** Put button to add a new question in this game *****/ if (ICanEditQuestions) // I can edit questions @@ -2000,6 +1997,10 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games, bool QuestionExists; char *Anchor = NULL; + /***** Trivial check *****/ + if (!NumQsts) + return; + /***** Get maximum question index *****/ MaxQstInd = Gam_GetMaxQuestionIndexInGame (GamCod); // 0 is no questions in game @@ -2427,7 +2428,6 @@ void Gam_MoveUpQst (void) void Gam_MoveDownQst (void) { extern const char *Txt_Movement_not_allowed; - extern const char *Txt_This_game_has_no_questions; struct Gam_Games Games; struct Gam_Game Game; unsigned QstIndTop; @@ -2456,23 +2456,18 @@ void Gam_MoveDownQst (void) MaxQstInd = Gam_GetMaxQuestionIndexInGame (Game.GamCod); // 0 is no questions in game /***** Move down question *****/ - if (MaxQstInd) + if (QstIndTop < MaxQstInd) { - if (QstIndTop < MaxQstInd) - { - /* Indexes of questions to be exchanged */ - QstIndBottom = Gam_GetNextQuestionIndexInGame (Game.GamCod,QstIndTop); - if (!QstIndBottom) - Lay_ShowErrorAndExit ("Wrong index of question."); + /* Indexes of questions to be exchanged */ + QstIndBottom = Gam_GetNextQuestionIndexInGame (Game.GamCod,QstIndTop); + if (!QstIndBottom) + Lay_ShowErrorAndExit ("Wrong index of question."); - /* Exchange questions */ - Gam_ExchangeQuestions (Game.GamCod,QstIndTop,QstIndBottom); - } - else - Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed); + /* Exchange questions */ + Gam_ExchangeQuestions (Game.GamCod,QstIndTop,QstIndBottom); } else - Ale_ShowAlert (Ale_WARNING,Txt_This_game_has_no_questions); + Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed); /***** Show current game *****/ Gam_ShowOnlyOneGame (&Games,&Game, diff --git a/swad_match.c b/swad_match.c index c2326d3c0..9a7cada5c 100644 --- a/swad_match.c +++ b/swad_match.c @@ -478,6 +478,10 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, struct Mch_Match Match; bool ICanEditMatches = Mch_CheckIfICanEditMatches (); + /***** Trivial check *****/ + if (!NumMatches) + return; + /***** Reset match *****/ Mch_ResetMatch (&Match); diff --git a/swad_text.c b/swad_text.c index f7b09a255..bc6b5fd68 100644 --- a/swad_text.c +++ b/swad_text.c @@ -51586,27 +51586,6 @@ const char *Txt_There_was_a_problem_sending_an_email_automatically = "Ocorreu um problema ao enviar um email automaticamente."; #endif -const char *Txt_This_exam_has_no_sets_of_questions = -#if L==1 // ca - "Aquest examen no té conjunts de preguntes."; -#elif L==2 // de - "Dieses Prüfung hat keine sätze von Fragen."; -#elif L==3 // en - "This exam has no sets of questions."; -#elif L==4 // es - "Este examen no tiene conjuntos de preguntas."; -#elif L==5 // fr - "Cet examen n'a pas d'ensembles de questions."; -#elif L==6 // gn - "Este examen no tiene conjuntos de preguntas."; // Okoteve traducción -#elif L==7 // it - "Questo esame non ha set di domande."; -#elif L==8 // pl - "Ten egzamin nie ma zestawów pytań."; -#elif L==9 // pt - "Este exame não tem conjuntos de perguntas."; -#endif - const char *Txt_This_exam_has_no_questions = #if L==1 // ca "Aquest examen no té preguntes."; @@ -51628,27 +51607,6 @@ const char *Txt_This_exam_has_no_questions = "Este exame não tem perguntas."; #endif -const char *Txt_This_game_has_no_questions = -#if L==1 // ca - "Aquest joc no té preguntes."; -#elif L==2 // de - "Dieses Spiel hat keine Fragen."; -#elif L==3 // en - "This game has no questions."; -#elif L==4 // es - "Este juego no tiene preguntas."; -#elif L==5 // fr - "Ce jeu n'a pas de questions."; -#elif L==6 // gn - "Este juego no tiene preguntas."; // Okoteve traducción -#elif L==7 // it - "Questo gioco non ha domande."; -#elif L==8 // pl - "Ta gra nie ma pytania."; -#elif L==9 // pt - "Este jogo não tem perguntas."; -#endif - const char *Txt_This_link_will_remain_active_as_long_as_your_user_s_account_exists = #if L==1 // ca "Aquest enllaç romandrà actiu mentre existeixi el seu compte de l'usuari.";