mirror of https://github.com/acanas/swad-core.git
Version19.14.2
This commit is contained in:
parent
690371760b
commit
c62b4b5f14
|
@ -470,14 +470,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
|||
En OpenSWAD:
|
||||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.14.1 (2019-09-25)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.14.2 (2019-09-26)"
|
||||
#define CSS_FILE "swad19.3.css"
|
||||
#define JS_FILE "swad18.130.2.js"
|
||||
/*
|
||||
// TODO: Poner columna en listado de juegos que indique el número de partidas
|
||||
// TODO: Imposibilitar la edición de preguntas de un juego cuando tenga partidas
|
||||
// TODO: Evitar que el estudiante vea el resultado de una partida cuando está oculto
|
||||
|
||||
Version 19.14.2: Sep 26, 2019 Student can not see a match result if hidden. (246227 lines)
|
||||
Version 19.14.1: Sep 25, 2019 Student can not see match results if hidden. (246207 lines)
|
||||
Version 19.14: Sep 25, 2019 New actions to show/hide match results. (246152 lines)
|
||||
5 changes necessary in database:
|
||||
|
|
88
swad_match.c
88
swad_match.c
|
@ -146,7 +146,8 @@ static void Mch_ListOneOrMoreMatchesNumPlayers (const struct Match *Match);
|
|||
static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned NumQsts);
|
||||
static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match);
|
||||
|
||||
static bool Mch_GetIfShowUsrResults (long MchCod);
|
||||
static bool Mch_CheckIfICanSeeMatchResult (long MchCod,long UsrCod);
|
||||
static bool Mch_GetVisibilityMchResultFromDB (long MchCod);
|
||||
|
||||
static void Mch_GetMatchDataFromRow (MYSQL_RES *mysql_res,
|
||||
struct Match *Match);
|
||||
|
@ -792,18 +793,52 @@ void Mch_ToggleVisibilResultsMchUsr (void)
|
|||
false); // Do not put form to start new match
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get if I can see match result ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Mch_CheckIfICanSeeMatchResult (long MchCod,long UsrCod)
|
||||
{
|
||||
bool ItsMe;
|
||||
bool ShowResultThisMatch;
|
||||
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
ItsMe = Usr_ItsMe (UsrCod);
|
||||
if (ItsMe && Gbl.Test.Config.Feedback != Tst_FEEDBACK_NOTHING)
|
||||
ShowResultThisMatch = Mch_GetVisibilityMchResultFromDB (MchCod);
|
||||
else
|
||||
ShowResultThisMatch = false;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
case Rol_DEG_ADM:
|
||||
case Rol_CTR_ADM:
|
||||
case Rol_INS_ADM:
|
||||
case Rol_SYS_ADM:
|
||||
ShowResultThisMatch = true;
|
||||
break;
|
||||
default:
|
||||
ShowResultThisMatch = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return ShowResultThisMatch;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get visibility of match result ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Mch_GetIfShowUsrResults (long MchCod)
|
||||
static bool Mch_GetVisibilityMchResultFromDB (long MchCod)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
bool ShowUsrResults;
|
||||
|
||||
/***** Get data of match from database *****/
|
||||
/***** Get visibility of match result from database *****/
|
||||
NumRows = (unsigned) DB_QuerySELECT (&mysql_res,"can not get if show result",
|
||||
"SELECT ShowUsrResults" // row[0]
|
||||
" FROM mch_matches"
|
||||
|
@ -3196,7 +3231,6 @@ static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther)
|
|||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
struct UsrData *UsrDat;
|
||||
bool ItsMe;
|
||||
bool ShowResultThisMatch;
|
||||
bool ShowSummaryResults = true;
|
||||
unsigned NumResults;
|
||||
|
@ -3256,28 +3290,8 @@ static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther)
|
|||
if ((MchCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||
Lay_ShowErrorAndExit ("Wrong code of match.");
|
||||
|
||||
/* Show results? */
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
||||
if (ItsMe && Gbl.Test.Config.Feedback != Tst_FEEDBACK_NOTHING)
|
||||
ShowResultThisMatch = Mch_GetIfShowUsrResults (MchCod);
|
||||
else
|
||||
ShowResultThisMatch = false;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
case Rol_DEG_ADM:
|
||||
case Rol_CTR_ADM:
|
||||
case Rol_INS_ADM:
|
||||
case Rol_SYS_ADM:
|
||||
ShowResultThisMatch = true;
|
||||
break;
|
||||
default:
|
||||
ShowResultThisMatch = false;
|
||||
break;
|
||||
}
|
||||
/* Show match result? */
|
||||
ShowResultThisMatch = Mch_CheckIfICanSeeMatchResult (MchCod,UsrDat->UsrCod);
|
||||
ShowSummaryResults = ShowSummaryResults && ShowResultThisMatch;
|
||||
|
||||
if (NumResult)
|
||||
|
@ -3538,15 +3552,25 @@ void Mch_ShowOneMchResult (void)
|
|||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
case Rol_STD:
|
||||
ICanViewResult = ItsMe;
|
||||
if (ItsMe)
|
||||
switch (MeOrOther)
|
||||
{
|
||||
Tst_GetConfigTstFromDB (); // To get feedback type
|
||||
ICanViewScore = Gbl.Test.Config.Feedback != Tst_FEEDBACK_NOTHING;
|
||||
case Usr_ME:
|
||||
ICanViewResult = ItsMe && Match.Status.ShowUsrResults;
|
||||
if (ICanViewResult)
|
||||
{
|
||||
Tst_GetConfigTstFromDB (); // To get feedback type
|
||||
ICanViewScore = Gbl.Test.Config.Feedback != Tst_FEEDBACK_NOTHING;
|
||||
}
|
||||
else
|
||||
ICanViewScore = false;
|
||||
break;
|
||||
default:
|
||||
ICanViewResult =
|
||||
ICanViewScore = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
ICanViewScore = false;
|
||||
break;
|
||||
case Rol_NET:
|
||||
case Rol_TCH:
|
||||
case Rol_DEG_ADM:
|
||||
case Rol_CTR_ADM:
|
||||
|
|
Loading…
Reference in New Issue