Version 22.120.12:Sep 10, 2023 Code refactoring related to hidden-visible in exam sessions.

This commit is contained in:
acanas 2023-09-10 14:22:11 +02:00
parent 516a789d1e
commit 50ef20a997
4 changed files with 18 additions and 33 deletions

View File

@ -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.11 (2023-09-09)"
#define Log_PLATFORM_VERSION "SWAD 22.120.12 (2023-09-10)"
#define CSS_FILE "swad22.120.4.css"
#define JS_FILE "swad22.49.js"
/*
Version 22.120.12:Sep 10, 2023 Code refactoring related to hidden-visible in exam sessions. (337584 lines)
Version 22.120.11:Sep 09, 2023 Code refactoring related to hidden-visible in exam sessions. (337594 lines)
Version 22.120.10:Sep 09, 2023 Code refactoring related to hidden-visible in exams. (337604 lines)
Version 22.120.9: Sep 09, 2023 Code refactoring related to hidden-visible in attendance. (337607 lines)

View File

@ -135,6 +135,8 @@ static Gam_Order_t Gam_GetParOrder (void);
static void Gam_RemoveGameFromAllTables (long GamCod);
static void Gam_HideUnhideGame (HidVis_HiddenOrVisible_t HiddenOrVisible);
static void Gam_PutFormEditionGame (struct Gam_Games *Games,
char Txt[Cns_MAX_BYTES_TEXT + 1],
Gam_ExistingNewGame_t ExistingNewGame);
@ -1124,40 +1126,20 @@ void Gam_RemoveCrsGames (long CrsCod)
}
/*****************************************************************************/
/******************************** Hide a game ******************************/
/***************************** Hide/unhide a game ****************************/
/*****************************************************************************/
void Gam_HideGame (void)
{
struct Gam_Games Games;
/***** Reset games context *****/
Gam_ResetGames (&Games);
/***** Reset game *****/
Gam_ResetGame (&Games.Game);
/***** Get parameters *****/
if ((Games.Game.GamCod = Gam_GetPars (&Games)) <= 0)
Err_WrongGameExit ();
/***** Get data of the game from database *****/
Gam_GetGameDataByCod (&Games.Game);
if (!Gam_CheckIfICanEditGames ())
Err_NoPermissionExit ();
/***** Hide game *****/
Gam_DB_HideOrUnhideGame (Games.Game.GamCod,true);
/***** Show games again *****/
Gam_ListAllGames (&Games);
Gam_HideUnhideGame (HidVis_HIDDEN);
}
/*****************************************************************************/
/******************************** Show a game ******************************/
/*****************************************************************************/
void Gam_UnhideGame (void)
{
Gam_HideUnhideGame (HidVis_VISIBLE);
}
static void Gam_HideUnhideGame (HidVis_HiddenOrVisible_t HiddenOrVisible)
{
struct Gam_Games Games;
@ -1177,7 +1159,7 @@ void Gam_UnhideGame (void)
Err_NoPermissionExit ();
/***** Unhide game *****/
Gam_DB_HideOrUnhideGame (Games.Game.GamCod,false);
Gam_DB_HideOrUnhideGame (Games.Game.GamCod,HiddenOrVisible);
/***** Show games again *****/
Gam_ListAllGames (&Games);

View File

@ -96,14 +96,15 @@ void Gam_DB_UpdateGame (const struct Gam_Game *Game,const char *Txt)
/*************************** Hide/unhide a game ******************************/
/*****************************************************************************/
void Gam_DB_HideOrUnhideGame (long GamCod,bool Hide)
void Gam_DB_HideOrUnhideGame (long GamCod,
HidVis_HiddenOrVisible_t HiddenOrVisible)
{
DB_QueryUPDATE ("can not hide/unhide game",
"UPDATE gam_games"
" SET Hidden='%c'"
" WHERE GamCod=%ld",
Hide ? 'Y' :
'N',
HiddenOrVisible == HidVis_HIDDEN ? 'Y' :
'N',
GamCod);
}

View File

@ -39,7 +39,8 @@
//--------------------------------- Games -------------------------------------
long Gam_DB_CreateGame (const struct Gam_Game *Game,const char *Txt);
void Gam_DB_UpdateGame (const struct Gam_Game *Game,const char *Txt);
void Gam_DB_HideOrUnhideGame (long GamCod,bool Hide);
void Gam_DB_HideOrUnhideGame (long GamCod,
HidVis_HiddenOrVisible_t HiddenOrVisible);
unsigned Gam_DB_GetListGames (MYSQL_RES **mysql_res,Gam_Order_t SelectedOrder);
unsigned Gam_DB_GetListAvailableGames (MYSQL_RES **mysql_res);