From af4f21d673ee658a66399d9509a6eee12ec212b5 Mon Sep 17 00:00:00 2001 From: acanas Date: Sat, 1 Oct 2022 13:51:03 +0200 Subject: [PATCH] Version 22.37.1: Oct 01, 2022 Fixed issues in exams and games. --- swad_changelog.h | 3 ++- swad_exam.c | 39 +++++++++++++++-------------- swad_exam_session.c | 26 +++++++++++--------- swad_game.c | 30 +++++++++-------------- swad_text_action.c | 60 ++++++++++++++++++++++----------------------- 5 files changed, 78 insertions(+), 80 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index d87e232b8..109ada1a2 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -606,10 +606,11 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate TODO: Attach pdf files in multimedia. */ -#define Log_PLATFORM_VERSION "SWAD 22.37 (2022-10-01)" +#define Log_PLATFORM_VERSION "SWAD 22.37.1 (2022-10-01)" #define CSS_FILE "swad22.35.css" #define JS_FILE "swad21.100.js" /* + Version 22.37.1: Oct 01, 2022 Fixed issues in exams and games. (332527 lines) Version 22.37: Oct 01, 2022 Code refactoring and changes in layout of games. (? lines) Version 22.36.1: Sep 30, 2022 Changes in layout of exams. (332596 lines) Version 22.36: Sep 30, 2022 Code refactoring in exams. (332589 lines) diff --git a/swad_exam.c b/swad_exam.c index 81a8a3485..94eb5cd6b 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -244,8 +244,7 @@ void Exa_ListAllExams (struct Exa_Exams *Exams) /***** Table head *****/ HTM_TABLE_BeginWideMarginPadding (5); HTM_TR_Begin (NULL); - if (Exa_CheckIfICanEditExams ()) - HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,1,"CONTEXT_COL"); // Column for contextual icons + HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,1,"CONTEXT_COL"); // Column for contextual icons for (Order = (Exa_Order_t) 0; Order <= (Exa_Order_t) (Exa_NUM_ORDERS - 1); @@ -487,13 +486,12 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,bool ShowOnlyThisExam) /***** Icons related to this exam *****/ if (!ShowOnlyThisExam) - if (Exa_CheckIfICanEditExams ()) - { - HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL %s\"", - The_GetColorRows ()); - Exa_PutIconsToRemEditOneExam (Exams,Anchor); - HTM_TD_End (); - } + { + HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL %s\"", + The_GetColorRows ()); + Exa_PutIconsToRemEditOneExam (Exams,Anchor); + HTM_TD_End (); + } /***** Start/end date/time *****/ UniqueId++; @@ -680,18 +678,21 @@ static void Exa_PutIconsToRemEditOneExam (struct Exa_Exams *Exams, [Rol_SYS_ADM] = ActSeeUsrExaResExa, }; - /***** Icon to remove exam *****/ - Ico_PutContextualIconToRemove (ActReqRemExa,NULL, - Exa_PutParams,Exams); + if (Exa_CheckIfICanEditExams ()) + { + /***** Icon to remove exam *****/ + Ico_PutContextualIconToRemove (ActReqRemExa,NULL, + Exa_PutParams,Exams); - /***** Icon to hide/unhide exam *****/ - Ico_PutContextualIconToHideUnhide (ActionHideUnhide,Anchor, - Exa_PutParams,Exams, - Exams->Exam.Hidden); + /***** Icon to hide/unhide exam *****/ + Ico_PutContextualIconToHideUnhide (ActionHideUnhide,Anchor, + Exa_PutParams,Exams, + Exams->Exam.Hidden); - /***** Icon to edit exam *****/ - Ico_PutContextualIconToEdit (ActEdiOneExa,NULL, - Exa_PutParams,Exams); + /***** Icon to edit exam *****/ + Ico_PutContextualIconToEdit (ActEdiOneExa,NULL, + Exa_PutParams,Exams); + } /***** Put icon to view results of sessions in exam *****/ if (ActionShowResults[Gbl.Usrs.Me.Role.Logged]) diff --git a/swad_exam_session.c b/swad_exam_session.c index afc9bc41e..b99ecc948 100644 --- a/swad_exam_session.c +++ b/swad_exam_session.c @@ -300,8 +300,7 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams, /* Icons */ if (ICanEditSessions) - if (ExaSes_CheckIfICanEditThisSession (Session.UsrCod)) - ExaSes_ListOneOrMoreSessionsIcons (Exams,&Session,Anchor); + ExaSes_ListOneOrMoreSessionsIcons (Exams,&Session,Anchor); /* Session participant */ ExaSes_ListOneOrMoreSessionsAuthor (&Session); @@ -435,18 +434,21 @@ static void ExaSes_ListOneOrMoreSessionsIcons (struct Exa_Exams *Exams, /***** Begin cell *****/ HTM_TD_Begin ("class=\"BT %s\"",The_GetColorRows ()); - /***** Icon to remove the exam session *****/ - Ico_PutContextualIconToRemove (ActReqRemExaSes,NULL, - ExaSes_PutParamsEdit,Exams); + if (ExaSes_CheckIfICanEditThisSession (Session->UsrCod)) + { + /***** Icon to remove the exam session *****/ + Ico_PutContextualIconToRemove (ActReqRemExaSes,NULL, + ExaSes_PutParamsEdit,Exams); - /***** Icon to hide/unhide the exam session *****/ - Ico_PutContextualIconToHideUnhide (ActionHideUnhide,Anchor, - ExaSes_PutParamsEdit,Exams, - Session->Hidden); + /***** Icon to hide/unhide the exam session *****/ + Ico_PutContextualIconToHideUnhide (ActionHideUnhide,Anchor, + ExaSes_PutParamsEdit,Exams, + Session->Hidden); - /***** Icon to edit the exam session *****/ - Ico_PutContextualIconToEdit (ActEdiOneExaSes,Anchor, - ExaSes_PutParamsEdit,Exams); + /***** Icon to edit the exam session *****/ + Ico_PutContextualIconToEdit (ActEdiOneExaSes,Anchor, + ExaSes_PutParamsEdit,Exams); + } /***** End cell *****/ HTM_TD_End (); diff --git a/swad_game.c b/swad_game.c index 4ef28b528..e6211c979 100644 --- a/swad_game.c +++ b/swad_game.c @@ -142,7 +142,7 @@ static void Gam_UpdateGame (struct Gam_Game *Game,const char *Txt); static void Gam_ListGameQuestions (struct Gam_Games *Games); static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games, - long GamCod,unsigned NumQsts, + unsigned NumQsts, MYSQL_RES *mysql_res, bool ICanEditQuestions); @@ -265,9 +265,7 @@ void Gam_ListAllGames (struct Gam_Games *Games) /***** Table head *****/ HTM_TR_Begin (NULL); - if (Gam_CheckIfICanEditGames () || - Gam_CheckIfICanListGameQuestions ()) - HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,1,"CONTEXT_COL"); // Column for contextual icons + HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,1,"CONTEXT_COL"); // Column for contextual icons for (Order = (Gam_Order_t) 0; Order <= (Gam_Order_t) (Gam_NUM_ORDERS - 1); @@ -536,14 +534,12 @@ static void Gam_ShowGameMainData (struct Gam_Games *Games, /***** Icons related to this game *****/ if (!ShowOnlyThisGame) - if (Gam_CheckIfICanEditGames () || - Gam_CheckIfICanListGameQuestions ()) - { - HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL %s\"", - The_GetColorRows ()); - Gam_PutIconsToRemEditOneGame (Games,Anchor); - HTM_TD_End (); - } + { + HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL %s\"", + The_GetColorRows ()); + Gam_PutIconsToRemEditOneGame (Games,Anchor); + HTM_TD_End (); + } /***** Start/end date/time *****/ UniqueId++; @@ -1654,8 +1650,7 @@ static void Gam_ListGameQuestions (struct Gam_Games *Games) /***** Show table with questions *****/ if (NumQsts) - Gam_ListOneOrMoreQuestionsForEdition (Games, - Games->Game.GamCod,NumQsts,mysql_res, + Gam_ListOneOrMoreQuestionsForEdition (Games,NumQsts,mysql_res, ICanEditQuestions); /***** Put button to add a new question in this game *****/ @@ -1674,7 +1669,7 @@ static void Gam_ListGameQuestions (struct Gam_Games *Games) /*****************************************************************************/ static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games, - long GamCod,unsigned NumQsts, + unsigned NumQsts, MYSQL_RES *mysql_res, bool ICanEditQuestions) { @@ -1698,7 +1693,7 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games, return; /***** Get maximum question index *****/ - MaxQstInd = Gam_DB_GetMaxQuestionIndexInGame (GamCod); // 0 is no questions in game + MaxQstInd = Gam_DB_GetMaxQuestionIndexInGame (Games->Game.GamCod); // 0 is no questions in game /***** Write the heading *****/ HTM_TABLE_BeginWideMarginPadding (5); @@ -1733,8 +1728,7 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Gam_Games *Games, snprintf (StrQstInd,sizeof (StrQstInd),"%u",QstInd); /* Initialize context */ - Games->Game.GamCod = GamCod; - Games->QstInd = QstInd; + Games->QstInd = QstInd; /***** Build anchor string *****/ Frm_SetAnchorStr (Question.QstCod,&Anchor); diff --git a/swad_text_action.c b/swad_text_action.c index f28f7661d..9549cedef 100644 --- a/swad_text_action.c +++ b/swad_text_action.c @@ -12668,71 +12668,71 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = , [ActSeeUsrExaResCrs] = #if L==1 // ca - "See all exam results of a user" // Necessita traducció + "See all exam results of selected users" // Necessita traducció #elif L==2 // de - "See all exam results of a user" // Need Übersetzung + "See all exam results of selected users" // Need Übersetzung #elif L==3 // en - "See all exam results of a user" + "See all exam results of selected users" #elif L==4 // es - "Ver todos los resultados de examen de un usuario" + "Ver todos los resultados de examen de usuarios seleccionados" #elif L==5 // fr - "See all exam results of a user" // Besoin de traduction + "See all exam results of selected users" // Besoin de traduction #elif L==6 // gn - "Ver todos los resultados de examen de un usuario" // Okoteve traducción + "Ver todos los resultados de examen de usuarios seleccionados" // Okoteve traducción #elif L==7 // it - "See all exam results of a user" // Bisogno di traduzione + "See all exam results of selected users" // Bisogno di traduzione #elif L==8 // pl - "See all exam results of a user" // Potrzebujesz tlumaczenie + "See all exam results of selected users" // Potrzebujesz tlumaczenie #elif L==9 // pt - "See all exam results of a user" // Precisa de tradução + "See all exam results of selected users" // Precisa de tradução #elif L==10 // tr - "See all exam results of a user" // Çeviri lazim! + "See all exam results of selected users" // Çeviri lazim! #endif , [ActSeeUsrExaResExa] = #if L==1 // ca - "See all results of a user in exam" // Necessita traducció + "See results of selected users in exam" // Necessita traducció #elif L==2 // de - "See all results of a user in exam" // Need Übersetzung + "See results of selected users in exam" // Need Übersetzung #elif L==3 // en - "See all results of a user in exam" + "See results of selected users in exam" #elif L==4 // es - "Ver todos los resultados de un usuario en examen" + "Ver resultados de usuarios seleccionados en examen" #elif L==5 // fr - "See all results of a user in exam" // Besoin de traduction + "See results of selected users in exam" // Besoin de traduction #elif L==6 // gn - "Ver todos los resultados de un usuario en examen" // Okoteve traducción + "Ver resultados de usuarios seleccionados en examen" // Okoteve traducción #elif L==7 // it - "See all results of a user in exam" // Bisogno di traduzione + "See results of selected users in exam" // Bisogno di traduzione #elif L==8 // pl - "See all results of a user in exam" // Potrzebujesz tlumaczenie + "See results of selected users in exam" // Potrzebujesz tlumaczenie #elif L==9 // pt - "See all results of a user in exam" // Precisa de tradução + "See results of selected users in exam" // Precisa de tradução #elif L==10 // tr - "See all results of a user in exam" // Çeviri lazim! + "See results of selected users in exam" // Çeviri lazim! #endif , [ActSeeUsrExaResSes] = #if L==1 // ca - "See all results of a user in exam session" // Necessita traducció + "See results of selected users in exam session" // Necessita traducció #elif L==2 // de - "See all results of a user in exam session" // Need Übersetzung + "See results of selected users in exam session" // Need Übersetzung #elif L==3 // en - "See all results of a user in exam session" + "See results of selected users in exam session" #elif L==4 // es - "Ver todos los resultados de un usuario en una sesión de examen" + "Ver resultados de usuarios seleccionados en sesión de examen" #elif L==5 // fr - "See all results of a user in exam session" // Besoin de traduction + "See results of selected users in exam session" // Besoin de traduction #elif L==6 // gn - "Ver todos los resultados de un usuario en una sesión de examen" // Okoteve traducción + "Ver resultados de usuarios seleccionados en sesión de examen" // Okoteve traducción #elif L==7 // it - "See all results of a user in exam session" // Bisogno di traduzione + "See results of selected users in exam session" // Bisogno di traduzione #elif L==8 // pl - "See all results of a user in exam session" // Potrzebujesz tlumaczenie + "See results of selected users in exam session" // Potrzebujesz tlumaczenie #elif L==9 // pt - "See all results of a user in exam session" // Precisa de tradução + "See results of selected users in exam session" // Precisa de tradução #elif L==10 // tr - "See all results of a user in exam session" // Çeviri lazim! + "See results of selected users in exam session" // Çeviri lazim! #endif , [ActSeeOneExaResOth] =