From 4323ce62edc9231b0e66b6af3980b7bec1208122 Mon Sep 17 00:00:00 2001 From: acanas Date: Sat, 9 Sep 2023 15:58:55 +0200 Subject: [PATCH] Version 22.120.9: Sep 09, 2023 Code refactoring related to hidden-visible in attendance. --- swad_attendance.c | 29 ++++++++++------------------- swad_attendance_database.c | 7 ++++--- swad_attendance_database.h | 3 ++- swad_changelog.h | 3 ++- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/swad_attendance.c b/swad_attendance.c index dddfaee2f..a5b400899 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -108,6 +108,8 @@ static void Att_ResetEvent (struct Att_Event *Event); static void Att_FreeListEvents (struct Att_Events *Events); +static void Att_HideUnhideEvent (HidVis_HiddenOrVisible_t HiddenOrVisible); + static void Att_PutParAttCod (void *Events); static void Att_ShowLstGrpsToEditEvent (long AttCod); @@ -875,31 +877,20 @@ void Att_RemoveEventFromDB (long AttCod) } /*****************************************************************************/ -/************************* Hide an attendance event **************************/ +/********************* Hide/unhide an attendance event ***********************/ /*****************************************************************************/ void Att_HideEvent (void) { - struct Att_Event Event; - - /***** Get attendance event code *****/ - Event.AttCod = ParCod_GetAndCheckPar (ParCod_Att); - - /***** Get data of the attendance event from database *****/ - Att_GetEventDataByCodAndCheckCrs (&Event); - - /***** Hide attendance event *****/ - Att_DB_HideOrUnhideEvent (Event.AttCod,true); - - /***** Show attendance events again *****/ - Att_SeeEvents (); + Att_HideUnhideEvent (HidVis_HIDDEN); } -/*****************************************************************************/ -/************************ Unhide an attendance event *************************/ -/*****************************************************************************/ - void Att_UnhideEvent (void) + { + Att_HideUnhideEvent (HidVis_VISIBLE); + } + +static void Att_HideUnhideEvent (HidVis_HiddenOrVisible_t HiddenOrVisible) { struct Att_Event Event; @@ -910,7 +901,7 @@ void Att_UnhideEvent (void) Att_GetEventDataByCodAndCheckCrs (&Event); /***** Unhide attendance event *****/ - Att_DB_HideOrUnhideEvent (Event.AttCod,false); + Att_DB_HideOrUnhideEvent (Event.AttCod,HiddenOrVisible); /***** Show attendance events again *****/ Att_SeeEvents (); diff --git a/swad_attendance_database.c b/swad_attendance_database.c index 87c74f5d3..cde039b71 100644 --- a/swad_attendance_database.c +++ b/swad_attendance_database.c @@ -297,15 +297,16 @@ void Att_DB_UpdateEvent (const struct Att_Event *Event,const char *Description) /********************** Hide/unhide an attendance event **********************/ /*****************************************************************************/ -void Att_DB_HideOrUnhideEvent (long AttCod,bool Hide) +void Att_DB_HideOrUnhideEvent (long AttCod, + HidVis_HiddenOrVisible_t HiddenOrVisible) { DB_QueryUPDATE ("can not hide/unhide assignment", "UPDATE att_events" " SET Hidden='%c'" " WHERE AttCod=%ld" " AND CrsCod=%ld", - Hide ? 'Y' : - 'N', + HiddenOrVisible == HidVis_HIDDEN ? 'Y' : + 'N', AttCod, Gbl.Hierarchy.Crs.CrsCod); } diff --git a/swad_attendance_database.h b/swad_attendance_database.h index f2923870c..e75390b06 100644 --- a/swad_attendance_database.h +++ b/swad_attendance_database.h @@ -52,7 +52,8 @@ bool Att_DB_CheckIfSimilarEventExists (const char *Field,const char *Value,long long Att_DB_CreateEvent (const struct Att_Event *Event,const char *Description); void Att_DB_UpdateEvent (const struct Att_Event *Event,const char *Description); -void Att_DB_HideOrUnhideEvent (long AttCod,bool Hide); +void Att_DB_HideOrUnhideEvent (long AttCod, + HidVis_HiddenOrVisible_t HiddenOrVisible); void Att_DB_CreateGroup (long AttCod,long GrpCod); unsigned Att_DB_GetGrpCodsAssociatedToEvent (MYSQL_RES **mysql_res,long AttCod); diff --git a/swad_changelog.h b/swad_changelog.h index 9037c28fe..d106cf412 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen. */ -#define Log_PLATFORM_VERSION "SWAD 22.120.8 (2023-09-09)" +#define Log_PLATFORM_VERSION "SWAD 22.120.9 (2023-09-09)" #define CSS_FILE "swad22.120.4.css" #define JS_FILE "swad22.49.js" /* + Version 22.120.9: Sep 09, 2023 Code refactoring related to hidden-visible in attendance. (337607 lines) Version 22.120.8: Sep 09, 2023 Code refactoring related to hidden-visible in assignments. (337610 lines) Version 22.120.7: Sep 09, 2023 Code refactoring related to hidden-visible in agendas. (337619 lines) Version 22.120.6: Sep 09, 2023 Fixed bug hiding documents. Reported by Francisco José Pelayo Valle. (337628 lines)