Version19.87.1

This commit is contained in:
Antonio Cañas Vargas 2019-12-08 14:14:29 +01:00
parent 705958aacf
commit 366f44f0ec
7 changed files with 45 additions and 35 deletions

View File

@ -490,14 +490,16 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.87 (2019-12-07)" #define Log_PLATFORM_VERSION "SWAD 19.87.1 (2019-12-07)"
#define CSS_FILE "swad19.85.css" #define CSS_FILE "swad19.85.css"
#define JS_FILE "swad19.70.js" #define JS_FILE "swad19.70.js"
/* /*
// TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.)
// TODO: Impedir la creación y edición de proyectos si no son editables. // TODO: Impedir la creación y edición de proyectos si no son editables.
// TODO: En cada partida, poder listar los resultados en una tabla como la de resultados globales // TODO: En cada partida, poder listar los resultados en una tabla como la de resultados globales
// TODO: En el resultado detallado de una partida, cambiar título "Resultado de una partida" por el título de la partida
Version 19.87.1: Dec 08, 2019 Changes and bug fixing in results of matches. (248000 lines)
Version 19.87: Dec 08, 2019 Show matches results in a game for all students. (247990 lines) Version 19.87: Dec 08, 2019 Show matches results in a game for all students. (247990 lines)
Version 19.86.1: Dec 07, 2019 Show matches results in a game for a student. (247901 lines) Version 19.86.1: Dec 07, 2019 Show matches results in a game for a student. (247901 lines)
Version 19.86: Dec 07, 2019 New actions to show the matches results in a game. (247905 lines) Version 19.86: Dec 07, 2019 New actions to show the matches results in a game. (247905 lines)

View File

@ -310,12 +310,12 @@ static void Gam_PutIconsListGames (void)
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
Ico_PutContextualIconToShowResults (ActSeeAllMyMchRes,NULL); Ico_PutContextualIconToShowResults (ActSeeAllMyMchRes,NULL,NULL);
break; break;
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
Ico_PutContextualIconToShowResults (ActReqSeeAllMchRes,NULL); Ico_PutContextualIconToShowResults (ActReqSeeAllMchRes,NULL,NULL);
break; break;
default: default:
break; break;
@ -580,12 +580,12 @@ static void Gam_PutIconToShowResultsOfGame (void)
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
Ico_PutContextualIconToShowResults (ActSeeGamMyMchRes,Gam_PutParamCurrentGamCod); Ico_PutContextualIconToShowResults (ActSeeGamMyMchRes,McR_RESULTS_TABLE_ID,Gam_PutParams);
break; break;
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
Ico_PutContextualIconToShowResults (ActSeeGamMchRes,Gam_PutParamCurrentGamCod); Ico_PutContextualIconToShowResults (ActSeeGamMchRes,McR_RESULTS_TABLE_ID,Gam_PutParams);
break; break;
default: default:
break; break;

View File

@ -326,11 +326,11 @@ void Ico_PutContextualIconToCreateInFolder (Act_Action_t NextAction,void (*FuncP
Txt_Upload_file_or_create_folder); Txt_Upload_file_or_create_folder);
} }
void Ico_PutContextualIconToShowResults (Act_Action_t NextAction,void (*FuncParams) (void)) void Ico_PutContextualIconToShowResults (Act_Action_t NextAction,const char *Anchor,void (*FuncParams) (void))
{ {
extern const char *Txt_Results; extern const char *Txt_Results;
Lay_PutContextualLinkOnlyIcon (NextAction,NULL,FuncParams, Lay_PutContextualLinkOnlyIcon (NextAction,Anchor,FuncParams,
"tasks.svg", "tasks.svg",
Txt_Results); Txt_Results);
} }

View File

@ -69,7 +69,7 @@ void Ico_PutContextualIconToPrint (Act_Action_t NextAction,void (*FuncParams) (v
void Ico_PutContextualIconToCopy (Act_Action_t NextAction,void (*FuncParams) (void)); void Ico_PutContextualIconToCopy (Act_Action_t NextAction,void (*FuncParams) (void));
void Ico_PutContextualIconToPaste (Act_Action_t NextAction,void (*FuncParams) (void)); void Ico_PutContextualIconToPaste (Act_Action_t NextAction,void (*FuncParams) (void));
void Ico_PutContextualIconToCreateInFolder (Act_Action_t NextAction,void (*FuncParams) (void),bool Open); void Ico_PutContextualIconToCreateInFolder (Act_Action_t NextAction,void (*FuncParams) (void),bool Open);
void Ico_PutContextualIconToShowResults (Act_Action_t NextAction,void (*FuncParams) (void)); void Ico_PutContextualIconToShowResults (Act_Action_t NextAction,const char *Anchor,void (*FuncParams) (void));
void Ico_PutContextualIconToShowAttendanceList (Act_Action_t NextAction,void (*FuncParams) (void)); void Ico_PutContextualIconToShowAttendanceList (Act_Action_t NextAction,void (*FuncParams) (void));
void Ico_PutContextualIconToZIP (Act_Action_t NextAction,void (*FuncParams) (void)); void Ico_PutContextualIconToZIP (Act_Action_t NextAction,void (*FuncParams) (void));

View File

@ -53,8 +53,6 @@ extern struct Globals Gbl;
/***************************** Private constants *****************************/ /***************************** Private constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define McR_RESULTS_TABLE_ID "mcr_table"
/*****************************************************************************/ /*****************************************************************************/
/******************************* Private types *******************************/ /******************************* Private types *******************************/
/*****************************************************************************/ /*****************************************************************************/
@ -75,7 +73,7 @@ static void McR_ShowUsrsMchResults (void);
static void McR_ListGamesToSelect (void); static void McR_ListGamesToSelect (void);
static void McR_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther); static void McR_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther);
static void McR_BuildGamesSelectedCommas (char *GamesSelectedCommas); static void McR_BuildGamesSelectedCommas (char **GamesSelectedCommas);
static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther, static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
const char *GamesSelectedSeparatedByCommas); const char *GamesSelectedSeparatedByCommas);
static void McR_ShowMchResultsSummaryRow (unsigned NumResults, static void McR_ShowMchResultsSummaryRow (unsigned NumResults,
@ -207,13 +205,10 @@ void McR_ShowMyMchRes (void)
/***** Get list of games *****/ /***** Get list of games *****/
Gam_GetListGames (Gam_ORDER_BY_TITLE); Gam_GetListGames (Gam_ORDER_BY_TITLE);
Gam_GetListSelectedGamCods (); Gam_GetListSelectedGamCods ();
McR_BuildGamesSelectedCommas (GamesSelectedCommas); McR_BuildGamesSelectedCommas (&GamesSelectedCommas);
if (Gbl.Games.NumSelected) if (Gbl.Games.NumSelected)
{ {
/***** Get feedback type *****/
Tst_GetConfigTstFromDB ();
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Results,NULL, Box_BoxBegin (NULL,Txt_Results,NULL,
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE); Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
@ -224,6 +219,7 @@ void McR_ShowMyMchRes (void)
McR_ShowHeaderMchResults (Usr_ME); McR_ShowHeaderMchResults (Usr_ME);
/***** List my matches results *****/ /***** List my matches results *****/
Tst_GetConfigTstFromDB (); // Get feedback type
McR_ShowMchResults (Usr_ME,GamesSelectedCommas); McR_ShowMchResults (Usr_ME,GamesSelectedCommas);
/***** End section with match results table *****/ /***** End section with match results table *****/
@ -252,17 +248,20 @@ void McR_ShowMyMchResInGame (void)
extern const char *Hlp_ASSESSMENT_Games_results; extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Results; extern const char *Txt_Results;
extern const char *Txt_No_games; extern const char *Txt_No_games;
long GamCod; struct Game Game;
char *GamesSelectedCommas; char *GamesSelectedCommas;
/***** Get game code *****/ /***** Get parameters *****/
if ((GamCod = Gam_GetParamGameCod ()) == -1L) if ((Game.GamCod = Gam_GetParams ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing."); Lay_ShowErrorAndExit ("Code of game is missing.");
if (asprintf (&GamesSelectedCommas,"%ld",GamCod) < 0) if (asprintf (&GamesSelectedCommas,"%ld",Game.GamCod) < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
/***** Get feedback type *****/ /***** Show game *****/
Tst_GetConfigTstFromDB (); Gam_ShowOneGame (Game.GamCod,
true, // Show only this game
false, // Do not list game questions
false); // Do not put form to start new match
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Results,NULL, Box_BoxBegin (NULL,Txt_Results,NULL,
@ -274,6 +273,7 @@ void McR_ShowMyMchResInGame (void)
McR_ShowHeaderMchResults (Usr_ME); McR_ShowHeaderMchResults (Usr_ME);
/***** List my matches results *****/ /***** List my matches results *****/
Tst_GetConfigTstFromDB (); // Get feedback type
McR_ShowMchResults (Usr_ME,GamesSelectedCommas); McR_ShowMchResults (Usr_ME,GamesSelectedCommas);
/***** End section with match results table *****/ /***** End section with match results table *****/
@ -313,7 +313,7 @@ static void McR_ShowUsrsMchResults (void)
/***** Get list of games *****/ /***** Get list of games *****/
Gam_GetListGames (Gam_ORDER_BY_TITLE); Gam_GetListGames (Gam_ORDER_BY_TITLE);
Gam_GetListSelectedGamCods (); Gam_GetListSelectedGamCods ();
McR_BuildGamesSelectedCommas (GamesSelectedCommas); McR_BuildGamesSelectedCommas (&GamesSelectedCommas);
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Results,NULL, Box_BoxBegin (NULL,Txt_Results,NULL,
@ -364,19 +364,25 @@ void McR_ShowUsrsMchResultsInGame (void)
{ {
extern const char *Hlp_ASSESSMENT_Games_results; extern const char *Hlp_ASSESSMENT_Games_results;
extern const char *Txt_Results; extern const char *Txt_Results;
long GamCod; struct Game Game;
char *GamesSelectedCommas; char *GamesSelectedCommas;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned long NumUsrs; unsigned long NumUsrs;
unsigned long NumUsr; unsigned long NumUsr;
/***** Get game code *****/ /***** Get parameters *****/
if ((GamCod = Gam_GetParamGameCod ()) == -1L) if ((Game.GamCod = Gam_GetParams ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing."); Lay_ShowErrorAndExit ("Code of game is missing.");
if (asprintf (&GamesSelectedCommas,"%ld",GamCod) < 0) if (asprintf (&GamesSelectedCommas,"%ld",Game.GamCod) < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
/***** Show game *****/
Gam_ShowOneGame (Game.GamCod,
true, // Show only this game
false, // Do not list game questions
false); // Do not put form to start new match
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Results,NULL, Box_BoxBegin (NULL,Txt_Results,NULL,
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE); Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
@ -388,7 +394,7 @@ void McR_ShowUsrsMchResultsInGame (void)
" WHERE mch_matches.GamCod=%ld" " WHERE mch_matches.GamCod=%ld"
" AND mch_matches.MchCod=mch_answers.MchCod" " AND mch_matches.MchCod=mch_answers.MchCod"
" ORDER BY mch_answers.UsrCod", // TODO: Order by name " ORDER BY mch_answers.UsrCod", // TODO: Order by name
GamCod); Game.GamCod);
if (NumUsrs) if (NumUsrs)
{ {
/***** Start section with match results table *****/ /***** Start section with match results table *****/
@ -554,7 +560,7 @@ static void McR_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther)
/******* from list of selected games ********/ /******* from list of selected games ********/
/*****************************************************************************/ /*****************************************************************************/
static void McR_BuildGamesSelectedCommas (char *GamesSelectedCommas) static void McR_BuildGamesSelectedCommas (char **GamesSelectedCommas)
{ {
size_t MaxLength; size_t MaxLength;
unsigned NumGame; unsigned NumGame;
@ -562,20 +568,20 @@ static void McR_BuildGamesSelectedCommas (char *GamesSelectedCommas)
/***** Allocate memory for subquery of games selected *****/ /***** Allocate memory for subquery of games selected *****/
MaxLength = (size_t) Gbl.Games.NumSelected * (Cns_MAX_DECIMAL_DIGITS_LONG + 1); MaxLength = (size_t) Gbl.Games.NumSelected * (Cns_MAX_DECIMAL_DIGITS_LONG + 1);
if ((GamesSelectedCommas = (char *) malloc (MaxLength + 1)) == NULL) if ((*GamesSelectedCommas = (char *) malloc (MaxLength + 1)) == NULL)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
/***** Build subquery with list of selected games *****/ /***** Build subquery with list of selected games *****/
GamesSelectedCommas[0] = '\0'; (*GamesSelectedCommas)[0] = '\0';
for (NumGame = 0; for (NumGame = 0;
NumGame < Gbl.Games.Num; NumGame < Gbl.Games.Num;
NumGame++) NumGame++)
if (Gbl.Games.Lst[NumGame].Selected) if (Gbl.Games.Lst[NumGame].Selected)
{ {
sprintf (LongStr,"%ld",Gbl.Games.Lst[NumGame].GamCod); sprintf (LongStr,"%ld",Gbl.Games.Lst[NumGame].GamCod);
if (GamesSelectedCommas[0]) if ((*GamesSelectedCommas)[0])
Str_Concat (GamesSelectedCommas,",",MaxLength); Str_Concat (*GamesSelectedCommas,",",MaxLength);
Str_Concat (GamesSelectedCommas,LongStr,MaxLength); Str_Concat (*GamesSelectedCommas,LongStr,MaxLength);
} }
} }

View File

@ -31,6 +31,8 @@
/************************** Public types and constants ***********************/ /************************** Public types and constants ***********************/
/*****************************************************************************/ /*****************************************************************************/
#define McR_RESULTS_TABLE_ID "mcr_table"
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1406,12 +1406,12 @@ static void Tst_PutIconsTests (void)
switch (Gbl.Usrs.Me.Role.Logged) switch (Gbl.Usrs.Me.Role.Logged)
{ {
case Rol_STD: case Rol_STD:
Ico_PutContextualIconToShowResults (ActReqSeeMyTstRes,NULL); Ico_PutContextualIconToShowResults (ActReqSeeMyTstRes,NULL,NULL);
break; break;
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
case Rol_SYS_ADM: case Rol_SYS_ADM:
Ico_PutContextualIconToShowResults (ActReqSeeUsrTstRes,NULL); Ico_PutContextualIconToShowResults (ActReqSeeUsrTstRes,NULL,NULL);
break; break;
default: default:
break; break;