mirror of https://github.com/acanas/swad-core.git
Version19.87
This commit is contained in:
parent
46356d84ed
commit
705958aacf
|
@ -2168,12 +2168,12 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
||||||
[ActRefMchStd ] = {1782,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Mch_GetMatchBeingPlayed ,Mch_RefreshMatchStd ,NULL},
|
[ActRefMchStd ] = {1782,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Mch_GetMatchBeingPlayed ,Mch_RefreshMatchStd ,NULL},
|
||||||
|
|
||||||
[ActSeeAllMyMchRes ] = {1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowMyMchRes ,NULL},
|
[ActSeeAllMyMchRes ] = {1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowMyMchRes ,NULL},
|
||||||
[ActSeeGamMyMchRes ] = {1810,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowMyMchRes ,NULL},
|
[ActSeeGamMyMchRes ] = {1810,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowMyMchResInGame ,NULL},
|
||||||
[ActSeeOneMchResMe ] = {1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowOneMchResult ,NULL},
|
[ActSeeOneMchResMe ] = {1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowOneMchResult ,NULL},
|
||||||
|
|
||||||
[ActReqSeeAllMchRes ] = {1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,McR_SelUsrsToViewUsrsMchRes ,NULL},
|
[ActReqSeeAllMchRes ] = {1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,McR_SelUsrsToViewUsrsMchRes ,NULL},
|
||||||
[ActSeeAllMchRes ] = {1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_GetUsrsAndShowMchRes ,NULL},
|
[ActSeeAllMchRes ] = {1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_GetUsrsAndShowMchRes ,NULL},
|
||||||
[ActSeeGamMchRes ] = {1811,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_GetUsrsAndShowMchResInGame ,NULL},
|
[ActSeeGamMchRes ] = {1811,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowUsrsMchResultsInGame ,NULL},
|
||||||
[ActSeeOneMchResOth ] = {1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowOneMchResult ,NULL},
|
[ActSeeOneMchResOth ] = {1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,McR_ShowOneMchResult ,NULL},
|
||||||
[ActChgVisResMchUsr ] = {1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisibilResultsMchUsr ,NULL},
|
[ActChgVisResMchUsr ] = {1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisibilResultsMchUsr ,NULL},
|
||||||
|
|
||||||
|
|
|
@ -490,14 +490,15 @@ 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.86.1 (2019-12-07)"
|
#define Log_PLATFORM_VERSION "SWAD 19.87 (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 juego, 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
|
||||||
|
|
||||||
|
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)
|
||||||
2 changes necessary in database:
|
2 changes necessary in database:
|
||||||
|
|
22
swad_game.c
22
swad_game.c
|
@ -805,37 +805,35 @@ void Gam_GetListGames (Gam_Order_t SelectedOrder)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Get list of game events selected **********************/
|
/********************* Get list of game events selected **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Return number of games selected
|
|
||||||
|
|
||||||
unsigned Gam_GetListSelectedGamCods (char **StrGamCodsSelected)
|
void Gam_GetListSelectedGamCods (void)
|
||||||
{
|
{
|
||||||
unsigned MaxSizeListGamCodsSelected;
|
unsigned MaxSizeListGamCodsSelected;
|
||||||
unsigned NumGame;
|
unsigned NumGame;
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
long GamCod;
|
long GamCod;
|
||||||
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
||||||
unsigned NumGamesSelected;
|
|
||||||
|
|
||||||
/***** Allocate memory for list of games selected *****/
|
/***** Allocate memory for list of games selected *****/
|
||||||
MaxSizeListGamCodsSelected = Gbl.Games.Num * (Cns_MAX_DECIMAL_DIGITS_LONG + 1);
|
MaxSizeListGamCodsSelected = Gbl.Games.Num * (Cns_MAX_DECIMAL_DIGITS_LONG + 1);
|
||||||
if ((*StrGamCodsSelected = (char *) malloc (MaxSizeListGamCodsSelected + 1)) == NULL)
|
if ((Gbl.Games.GamCodsSelected = (char *) malloc (MaxSizeListGamCodsSelected + 1)) == NULL)
|
||||||
Lay_NotEnoughMemoryExit ();
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
/***** Get parameter multiple with list of games selected *****/
|
/***** Get parameter multiple with list of games selected *****/
|
||||||
Par_GetParMultiToText ("GamCod",*StrGamCodsSelected,MaxSizeListGamCodsSelected);
|
Par_GetParMultiToText ("GamCod",Gbl.Games.GamCodsSelected,MaxSizeListGamCodsSelected);
|
||||||
|
|
||||||
/***** Set which games will be shown as selected (checkboxes on) *****/
|
/***** Set which games will be shown as selected (checkboxes on) *****/
|
||||||
if ((*StrGamCodsSelected)[0]) // There are games selected
|
if (Gbl.Games.GamCodsSelected[0]) // Some games selected
|
||||||
{
|
{
|
||||||
/* Reset selection */
|
/* Reset selection */
|
||||||
for (NumGame = 0;
|
for (NumGame = 0;
|
||||||
NumGame < Gbl.Games.Num;
|
NumGame < Gbl.Games.Num;
|
||||||
NumGame++)
|
NumGame++)
|
||||||
Gbl.Games.Lst[NumGame].Selected = false;
|
Gbl.Games.Lst[NumGame].Selected = false;
|
||||||
NumGamesSelected = 0;
|
Gbl.Games.NumSelected = 0;
|
||||||
|
|
||||||
/* Set some games as selected */
|
/* Set some games as selected */
|
||||||
for (Ptr = *StrGamCodsSelected;
|
for (Ptr = Gbl.Games.GamCodsSelected;
|
||||||
*Ptr;
|
*Ptr;
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -850,22 +848,20 @@ unsigned Gam_GetListSelectedGamCods (char **StrGamCodsSelected)
|
||||||
if (Gbl.Games.Lst[NumGame].GamCod == GamCod)
|
if (Gbl.Games.Lst[NumGame].GamCod == GamCod)
|
||||||
{
|
{
|
||||||
Gbl.Games.Lst[NumGame].Selected = true;
|
Gbl.Games.Lst[NumGame].Selected = true;
|
||||||
NumGamesSelected++;
|
Gbl.Games.NumSelected++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // No games selected
|
else // No games selected
|
||||||
{
|
{
|
||||||
/***** Set all games as selected *****/
|
/***** Set all games as selected *****/
|
||||||
for (NumGame = 0;
|
for (NumGame = 0;
|
||||||
NumGame < Gbl.Games.Num;
|
NumGame < Gbl.Games.Num;
|
||||||
NumGame++)
|
NumGame++)
|
||||||
Gbl.Games.Lst[NumGame].Selected = true;
|
Gbl.Games.Lst[NumGame].Selected = true;
|
||||||
NumGamesSelected = Gbl.Games.Num;
|
Gbl.Games.NumSelected = Gbl.Games.Num;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NumGamesSelected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -94,7 +94,7 @@ long Gam_GetParamGameCod (void);
|
||||||
long Gam_GetParams (void);
|
long Gam_GetParams (void);
|
||||||
|
|
||||||
void Gam_GetListGames (Gam_Order_t SelectedOrder);
|
void Gam_GetListGames (Gam_Order_t SelectedOrder);
|
||||||
unsigned Gam_GetListSelectedGamCods (char **StrGamCodsSelected);
|
void Gam_GetListSelectedGamCods (void);
|
||||||
void Gam_GetDataOfGameByCod (struct Game *Gam);
|
void Gam_GetDataOfGameByCod (struct Game *Gam);
|
||||||
void Gam_GetDataOfGameByFolder (struct Game *Gam);
|
void Gam_GetDataOfGameByFolder (struct Game *Gam);
|
||||||
void Gam_FreeListGames (void);
|
void Gam_FreeListGames (void);
|
||||||
|
|
|
@ -703,14 +703,16 @@ struct Globals
|
||||||
} DateRange;
|
} DateRange;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool LstIsRead; // Is the list already read from database, or it needs to be read?
|
bool LstIsRead; // Is the list already read from database...
|
||||||
unsigned Num; // Number of games
|
// ...or it needs to be read?
|
||||||
struct GameSelected *Lst; // List of games
|
unsigned Num; // Total number of games
|
||||||
|
unsigned NumSelected; // Number of games selected
|
||||||
|
struct GameSelected *Lst; // List of games
|
||||||
Gam_Order_t SelectedOrder;
|
Gam_Order_t SelectedOrder;
|
||||||
unsigned CurrentPage;
|
unsigned CurrentPage;
|
||||||
char *ListQuestions;
|
char *ListQuestions;
|
||||||
long MchCodBeingPlayed; // Used to refresh game via AJAX
|
long MchCodBeingPlayed; // Used to refresh game via AJAX
|
||||||
char *StrGamCodsSelected;
|
char *GamCodsSelected; // String with selected game codes separated by separator multiple
|
||||||
} Games;
|
} Games;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,8 +74,10 @@ extern struct Globals Gbl;
|
||||||
static void McR_ShowUsrsMchResults (void);
|
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_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
||||||
unsigned NumGamesSelected);
|
const char *GamesSelectedSeparatedByCommas);
|
||||||
static void McR_ShowMchResultsSummaryRow (unsigned NumResults,
|
static void McR_ShowMchResultsSummaryRow (unsigned NumResults,
|
||||||
unsigned NumTotalQsts,
|
unsigned NumTotalQsts,
|
||||||
unsigned NumTotalQstsNotBlank,
|
unsigned NumTotalQstsNotBlank,
|
||||||
|
@ -90,65 +92,6 @@ static void McR_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
|
||||||
static bool McR_CheckIfICanSeeMatchResult (long MchCod,long UsrCod);
|
static bool McR_CheckIfICanSeeMatchResult (long MchCod,long UsrCod);
|
||||||
static bool McR_GetVisibilityMchResultFromDB (long MchCod);
|
static bool McR_GetVisibilityMchResultFromDB (long MchCod);
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*************************** Show my matches results *************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void McR_ShowMyMchRes (void)
|
|
||||||
{
|
|
||||||
extern const char *Hlp_ASSESSMENT_Games_results;
|
|
||||||
extern const char *Hlp_ASSESSMENT_Games_results;
|
|
||||||
extern const char *Txt_Results;
|
|
||||||
extern const char *Txt_No_games;
|
|
||||||
unsigned NumGamesSelected;
|
|
||||||
|
|
||||||
/***** Get list of games *****/
|
|
||||||
Gam_GetListGames (Gam_ORDER_BY_TITLE);
|
|
||||||
|
|
||||||
/***** Get list of game codes selected *****/
|
|
||||||
NumGamesSelected = Gam_GetListSelectedGamCods (&Gbl.Games.StrGamCodsSelected);
|
|
||||||
|
|
||||||
if (NumGamesSelected)
|
|
||||||
{
|
|
||||||
/***** Begin box *****/
|
|
||||||
Box_BoxBegin (NULL,Txt_Results,NULL,
|
|
||||||
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
|
|
||||||
|
|
||||||
/***** List games to select *****/
|
|
||||||
McR_ListGamesToSelect ();
|
|
||||||
|
|
||||||
/***** Start section with match results table *****/
|
|
||||||
HTM_SECTION_Begin (McR_RESULTS_TABLE_ID);
|
|
||||||
|
|
||||||
/***** Begin table *****/
|
|
||||||
HTM_TABLE_BeginWidePadding (2);
|
|
||||||
|
|
||||||
/***** Header of the table with the list of users *****/
|
|
||||||
McR_ShowHeaderMchResults (Usr_ME);
|
|
||||||
|
|
||||||
/***** List my matches results *****/
|
|
||||||
Tst_GetConfigTstFromDB (); // To get feedback type
|
|
||||||
McR_ShowMchResults (Usr_ME,NumGamesSelected);
|
|
||||||
|
|
||||||
/***** End table *****/
|
|
||||||
HTM_TABLE_End ();
|
|
||||||
|
|
||||||
/***** End section with match results table *****/
|
|
||||||
HTM_SECTION_End ();
|
|
||||||
|
|
||||||
/***** End box *****/
|
|
||||||
Box_BoxEnd ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_No_games);
|
|
||||||
|
|
||||||
/***** Free memory for list of game events selected *****/
|
|
||||||
free (Gbl.Games.StrGamCodsSelected);
|
|
||||||
|
|
||||||
/***** Free list of games *****/
|
|
||||||
Gam_FreeListGames ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********** Select users and dates to show their matches results ************/
|
/*********** Select users and dates to show their matches results ************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -249,6 +192,101 @@ void McR_SelUsrsToViewUsrsMchRes (void)
|
||||||
Grp_FreeListCodSelectedGrps ();
|
Grp_FreeListCodSelectedGrps ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*************************** Show my matches results *************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void McR_ShowMyMchRes (void)
|
||||||
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Games_results;
|
||||||
|
extern const char *Hlp_ASSESSMENT_Games_results;
|
||||||
|
extern const char *Txt_Results;
|
||||||
|
extern const char *Txt_No_games;
|
||||||
|
char *GamesSelectedCommas = NULL; // Initialized to avoid warning
|
||||||
|
|
||||||
|
/***** Get list of games *****/
|
||||||
|
Gam_GetListGames (Gam_ORDER_BY_TITLE);
|
||||||
|
Gam_GetListSelectedGamCods ();
|
||||||
|
McR_BuildGamesSelectedCommas (GamesSelectedCommas);
|
||||||
|
|
||||||
|
if (Gbl.Games.NumSelected)
|
||||||
|
{
|
||||||
|
/***** Get feedback type *****/
|
||||||
|
Tst_GetConfigTstFromDB ();
|
||||||
|
|
||||||
|
/***** Begin box *****/
|
||||||
|
Box_BoxBegin (NULL,Txt_Results,NULL,
|
||||||
|
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
|
/***** Start section with match results table *****/
|
||||||
|
HTM_SECTION_Begin (McR_RESULTS_TABLE_ID);
|
||||||
|
HTM_TABLE_BeginWidePadding (2);
|
||||||
|
McR_ShowHeaderMchResults (Usr_ME);
|
||||||
|
|
||||||
|
/***** List my matches results *****/
|
||||||
|
McR_ShowMchResults (Usr_ME,GamesSelectedCommas);
|
||||||
|
|
||||||
|
/***** End section with match results table *****/
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
HTM_SECTION_End ();
|
||||||
|
|
||||||
|
/***** End box *****/
|
||||||
|
Box_BoxEnd ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Ale_ShowAlert (Ale_WARNING,Txt_No_games);
|
||||||
|
|
||||||
|
/***** Free list of games *****/
|
||||||
|
free (GamesSelectedCommas);
|
||||||
|
free (Gbl.Games.GamCodsSelected);
|
||||||
|
Gam_FreeListGames ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************** Show my matches results in a given game *******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
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_No_games;
|
||||||
|
long GamCod;
|
||||||
|
char *GamesSelectedCommas;
|
||||||
|
|
||||||
|
/***** Get game code *****/
|
||||||
|
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
if (asprintf (&GamesSelectedCommas,"%ld",GamCod) < 0)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/***** Get feedback type *****/
|
||||||
|
Tst_GetConfigTstFromDB ();
|
||||||
|
|
||||||
|
/***** Begin box *****/
|
||||||
|
Box_BoxBegin (NULL,Txt_Results,NULL,
|
||||||
|
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
|
/***** Start section with match results table *****/
|
||||||
|
HTM_SECTION_Begin (McR_RESULTS_TABLE_ID);
|
||||||
|
HTM_TABLE_BeginWidePadding (2);
|
||||||
|
McR_ShowHeaderMchResults (Usr_ME);
|
||||||
|
|
||||||
|
/***** List my matches results *****/
|
||||||
|
McR_ShowMchResults (Usr_ME,GamesSelectedCommas);
|
||||||
|
|
||||||
|
/***** End section with match results table *****/
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
HTM_SECTION_End ();
|
||||||
|
|
||||||
|
/***** End box *****/
|
||||||
|
Box_BoxEnd ();
|
||||||
|
|
||||||
|
/***** Free string with list of selected games separated by commas *****/
|
||||||
|
free (GamesSelectedCommas);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Get users and show their matches results *****************/
|
/****************** Get users and show their matches results *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -260,11 +298,6 @@ void McR_GetUsrsAndShowMchRes (void)
|
||||||
McR_SelUsrsToViewUsrsMchRes);
|
McR_SelUsrsToViewUsrsMchRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void McR_GetUsrsAndShowMchResInGame (void)
|
|
||||||
{
|
|
||||||
// TODO: Implement!!!
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Show matches results for several users *******************/
|
/****************** Show matches results for several users *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -274,68 +307,127 @@ static void McR_ShowUsrsMchResults (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;
|
||||||
unsigned NumGamesSelected;
|
char *GamesSelectedCommas = NULL; // Initialized to avoid warning
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
|
|
||||||
/***** Get list of games *****/
|
/***** Get list of games *****/
|
||||||
Gam_GetListGames (Gam_ORDER_BY_TITLE);
|
Gam_GetListGames (Gam_ORDER_BY_TITLE);
|
||||||
|
Gam_GetListSelectedGamCods ();
|
||||||
|
McR_BuildGamesSelectedCommas (GamesSelectedCommas);
|
||||||
|
|
||||||
/***** Get list of game codes selected *****/
|
/***** Begin box *****/
|
||||||
NumGamesSelected = Gam_GetListSelectedGamCods (&Gbl.Games.StrGamCodsSelected);
|
Box_BoxBegin (NULL,Txt_Results,NULL,
|
||||||
|
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
if (NumGamesSelected)
|
/***** List games to select *****/
|
||||||
|
McR_ListGamesToSelect ();
|
||||||
|
|
||||||
|
/***** Start section with match results table *****/
|
||||||
|
HTM_SECTION_Begin (McR_RESULTS_TABLE_ID);
|
||||||
|
HTM_TABLE_BeginWidePadding (2);
|
||||||
|
McR_ShowHeaderMchResults (Usr_OTHER);
|
||||||
|
|
||||||
|
/***** List the matches results of the selected users *****/
|
||||||
|
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
||||||
|
while (*Ptr)
|
||||||
{
|
{
|
||||||
/***** Begin box *****/
|
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,
|
||||||
Box_BoxBegin (NULL,Txt_Results,NULL,
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
||||||
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
|
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
||||||
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||||
/***** List games to select *****/
|
if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat))
|
||||||
McR_ListGamesToSelect ();
|
{
|
||||||
|
/***** Show matches results *****/
|
||||||
/***** Start section with match results table *****/
|
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||||
HTM_SECTION_Begin (McR_RESULTS_TABLE_ID);
|
McR_ShowMchResults (Usr_OTHER,GamesSelectedCommas);
|
||||||
|
}
|
||||||
/***** Begin table *****/
|
|
||||||
HTM_TABLE_BeginWidePadding (2);
|
|
||||||
|
|
||||||
/***** Header of the table with the list of users *****/
|
|
||||||
McR_ShowHeaderMchResults (Usr_OTHER);
|
|
||||||
|
|
||||||
/***** List the matches results of the selected users *****/
|
|
||||||
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
|
||||||
while (*Ptr)
|
|
||||||
{
|
|
||||||
Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod,
|
|
||||||
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
|
||||||
Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat);
|
|
||||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
|
||||||
if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat))
|
|
||||||
{
|
|
||||||
/***** Show matches results *****/
|
|
||||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
|
||||||
McR_ShowMchResults (Usr_OTHER,NumGamesSelected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table *****/
|
|
||||||
HTM_TABLE_End ();
|
|
||||||
|
|
||||||
/***** End section with match results table *****/
|
|
||||||
HTM_SECTION_End ();
|
|
||||||
|
|
||||||
/***** End box *****/
|
|
||||||
Box_BoxEnd ();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_No_games);
|
|
||||||
|
|
||||||
/***** Free memory for list of game events selected *****/
|
/***** End section with match results table *****/
|
||||||
free (Gbl.Games.StrGamCodsSelected);
|
HTM_TABLE_End ();
|
||||||
|
HTM_SECTION_End ();
|
||||||
|
|
||||||
|
/***** End box *****/
|
||||||
|
Box_BoxEnd ();
|
||||||
|
|
||||||
/***** Free list of games *****/
|
/***** Free list of games *****/
|
||||||
|
free (GamesSelectedCommas);
|
||||||
|
free (Gbl.Games.GamCodsSelected);
|
||||||
Gam_FreeListGames ();
|
Gam_FreeListGames ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/** Show matches results of a game for the users who answered in that game ***/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void McR_ShowUsrsMchResultsInGame (void)
|
||||||
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Games_results;
|
||||||
|
extern const char *Txt_Results;
|
||||||
|
long GamCod;
|
||||||
|
char *GamesSelectedCommas;
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
unsigned long NumUsrs;
|
||||||
|
unsigned long NumUsr;
|
||||||
|
|
||||||
|
/***** Get game code *****/
|
||||||
|
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
||||||
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
if (asprintf (&GamesSelectedCommas,"%ld",GamCod) < 0)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/***** Begin box *****/
|
||||||
|
Box_BoxBegin (NULL,Txt_Results,NULL,
|
||||||
|
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
|
/***** Make database query *****/
|
||||||
|
NumUsrs = DB_QuerySELECT (&mysql_res,"can not get matches results of a user",
|
||||||
|
"SELECT DISTINCT mch_answers.UsrCod" // row[0]
|
||||||
|
" FROM mch_matches,mch_answers"
|
||||||
|
" WHERE mch_matches.GamCod=%ld"
|
||||||
|
" AND mch_matches.MchCod=mch_answers.MchCod"
|
||||||
|
" ORDER BY mch_answers.UsrCod", // TODO: Order by name
|
||||||
|
GamCod);
|
||||||
|
if (NumUsrs)
|
||||||
|
{
|
||||||
|
/***** Start section with match results table *****/
|
||||||
|
HTM_SECTION_Begin (McR_RESULTS_TABLE_ID);
|
||||||
|
HTM_TABLE_BeginWidePadding (2);
|
||||||
|
McR_ShowHeaderMchResults (Usr_OTHER);
|
||||||
|
|
||||||
|
for (NumUsr = 0;
|
||||||
|
NumUsr < NumUsrs;
|
||||||
|
NumUsr++)
|
||||||
|
{
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
|
/* Get match code (row[0]) */
|
||||||
|
if ((Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
|
||||||
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS))
|
||||||
|
if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat))
|
||||||
|
{
|
||||||
|
/***** Show matches results *****/
|
||||||
|
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||||
|
McR_ShowMchResults (Usr_OTHER,GamesSelectedCommas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** End section with match results table *****/
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
HTM_SECTION_End ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
/***** End box *****/
|
||||||
|
Box_BoxEnd ();
|
||||||
|
|
||||||
|
/***** Free string with list of selected games separated by commas *****/
|
||||||
|
free (GamesSelectedCommas);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********** Write list of those attendance events that have students *********/
|
/********** Write list of those attendance events that have students *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -457,21 +549,47 @@ static void McR_ShowHeaderMchResults (Usr_MeOrOther_t MeOrOther)
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******* Build string with list of selected games separated by commas ********/
|
||||||
|
/******* from list of selected games ********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void McR_BuildGamesSelectedCommas (char *GamesSelectedCommas)
|
||||||
|
{
|
||||||
|
size_t MaxLength;
|
||||||
|
unsigned NumGame;
|
||||||
|
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
||||||
|
|
||||||
|
/***** Allocate memory for subquery of games selected *****/
|
||||||
|
MaxLength = (size_t) Gbl.Games.NumSelected * (Cns_MAX_DECIMAL_DIGITS_LONG + 1);
|
||||||
|
if ((GamesSelectedCommas = (char *) malloc (MaxLength + 1)) == NULL)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/***** Build subquery with list of selected games *****/
|
||||||
|
GamesSelectedCommas[0] = '\0';
|
||||||
|
for (NumGame = 0;
|
||||||
|
NumGame < Gbl.Games.Num;
|
||||||
|
NumGame++)
|
||||||
|
if (Gbl.Games.Lst[NumGame].Selected)
|
||||||
|
{
|
||||||
|
sprintf (LongStr,"%ld",Gbl.Games.Lst[NumGame].GamCod);
|
||||||
|
if (GamesSelectedCommas[0])
|
||||||
|
Str_Concat (GamesSelectedCommas,",",MaxLength);
|
||||||
|
Str_Concat (GamesSelectedCommas,LongStr,MaxLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********* Show the matches results of a user in the current course **********/
|
/********* Show the matches results of a user in the current course **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
||||||
unsigned NumGamesSelected)
|
const char *GamesSelectedCommas)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Match_result;
|
extern const char *Txt_Match_result;
|
||||||
extern const char *Txt_Hidden_result;
|
extern const char *Txt_Hidden_result;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
size_t MaxSizeGamesSubQuery;
|
|
||||||
char *GamesSubQuery;
|
|
||||||
unsigned NumGame;
|
|
||||||
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
|
||||||
struct UsrData *UsrDat;
|
struct UsrData *UsrDat;
|
||||||
bool ShowResultThisMatch;
|
bool ShowResultThisMatch;
|
||||||
bool ShowSummaryResults = true;
|
bool ShowSummaryResults = true;
|
||||||
|
@ -493,31 +611,15 @@ static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
||||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||||
|
|
||||||
/***** Trivial check: there should be games selected *****/
|
/***** Trivial check: there should be games selected *****/
|
||||||
if (!NumGamesSelected)
|
if (!GamesSelectedCommas)
|
||||||
|
return;
|
||||||
|
if (!GamesSelectedCommas[0])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Set user *****/
|
/***** Set user *****/
|
||||||
UsrDat = (MeOrOther == Usr_ME) ? &Gbl.Usrs.Me.UsrDat :
|
UsrDat = (MeOrOther == Usr_ME) ? &Gbl.Usrs.Me.UsrDat :
|
||||||
&Gbl.Usrs.Other.UsrDat;
|
&Gbl.Usrs.Other.UsrDat;
|
||||||
|
|
||||||
/***** Allocate memory for subquery of games selected *****/
|
|
||||||
MaxSizeGamesSubQuery = (size_t) NumGamesSelected * (Cns_MAX_DECIMAL_DIGITS_LONG + 1);
|
|
||||||
if ((GamesSubQuery = (char *) malloc (MaxSizeGamesSubQuery + 1)) == NULL)
|
|
||||||
Lay_NotEnoughMemoryExit ();
|
|
||||||
|
|
||||||
/***** Build subquery with list of selected games *****/
|
|
||||||
GamesSubQuery[0] = '\0';
|
|
||||||
for (NumGame = 0;
|
|
||||||
NumGame < Gbl.Games.Num;
|
|
||||||
NumGame++)
|
|
||||||
if (Gbl.Games.Lst[NumGame].Selected)
|
|
||||||
{
|
|
||||||
sprintf (LongStr,"%ld",Gbl.Games.Lst[NumGame].GamCod);
|
|
||||||
if (GamesSubQuery[0])
|
|
||||||
Str_Concat (GamesSubQuery,",",MaxSizeGamesSubQuery);
|
|
||||||
Str_Concat (GamesSubQuery,LongStr,MaxSizeGamesSubQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Make database query *****/
|
/***** Make database query *****/
|
||||||
NumResults =
|
NumResults =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get matches results of a user",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get matches results of a user",
|
||||||
|
@ -534,11 +636,10 @@ static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther,
|
||||||
" AND mch_matches.GamCod=gam_games.GamCod"
|
" AND mch_matches.GamCod=gam_games.GamCod"
|
||||||
" AND gam_games.CrsCod=%ld" // Extra check
|
" AND gam_games.CrsCod=%ld" // Extra check
|
||||||
" AND gam_games.GamCod IN (%s)"
|
" AND gam_games.GamCod IN (%s)"
|
||||||
" ORDER BY gam_games.Title",
|
" ORDER BY mch_matches.Title",
|
||||||
UsrDat->UsrCod,
|
UsrDat->UsrCod,
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
GamesSubQuery);
|
GamesSelectedCommas);
|
||||||
free (GamesSubQuery);
|
|
||||||
|
|
||||||
/***** Show user's data *****/
|
/***** Show user's data *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
|
@ -35,10 +35,13 @@
|
||||||
/***************************** Public prototypes *****************************/
|
/***************************** Public prototypes *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void McR_ShowMyMchRes (void);
|
|
||||||
void McR_SelUsrsToViewUsrsMchRes (void);
|
void McR_SelUsrsToViewUsrsMchRes (void);
|
||||||
|
|
||||||
|
void McR_ShowMyMchRes (void);
|
||||||
|
void McR_ShowMyMchResInGame (void);
|
||||||
void McR_GetUsrsAndShowMchRes (void);
|
void McR_GetUsrsAndShowMchRes (void);
|
||||||
void McR_GetUsrsAndShowMchResInGame (void);
|
void McR_ShowUsrsMchResultsInGame (void);
|
||||||
|
|
||||||
void McR_ShowOneMchResult (void);
|
void McR_ShowOneMchResult (void);
|
||||||
void McR_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
void McR_GetMatchResultQuestionsFromDB (long MchCod,long UsrCod,
|
||||||
unsigned *NumQsts,unsigned *NumQstsNotBlank);
|
unsigned *NumQsts,unsigned *NumQstsNotBlank);
|
||||||
|
|
Loading…
Reference in New Issue