mirror of https://github.com/acanas/swad-core.git
Version19.14.3
This commit is contained in:
parent
c62b4b5f14
commit
d0228f7ce2
|
@ -474,9 +474,9 @@ ps2pdf source.ps destination.pdf
|
|||
#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
|
||||
|
||||
Version 19.14.3: Sep 26, 2019 Column in game row with the number of matches. (246264 lines)
|
||||
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)
|
||||
|
|
68
swad_game.c
68
swad_game.c
|
@ -101,6 +101,8 @@ static void Gam_PutFormsToRemEditOneGame (const struct Game *Game,
|
|||
static void Gam_PutHiddenParamOrder (void);
|
||||
static void Gam_GetParamOrder (void);
|
||||
|
||||
static void Gam_ResetGame (struct Game *Game,long UsrCod);
|
||||
|
||||
static void Gam_GetGameTxtFromDB (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
|
||||
static bool Gam_CheckIfSimilarGameExists (struct Game *Game);
|
||||
|
@ -151,6 +153,7 @@ static void Gam_ListAllGames (void)
|
|||
extern const char *Txt_Games;
|
||||
extern const char *Txt_GAMES_ORDER_HELP[Gam_NUM_ORDERS];
|
||||
extern const char *Txt_GAMES_ORDER[Gam_NUM_ORDERS];
|
||||
extern const char *Txt_Matches;
|
||||
extern const char *Txt_No_games;
|
||||
Gam_Order_t Order;
|
||||
struct Pagination Pagination;
|
||||
|
@ -223,6 +226,9 @@ static void Gam_ListAllGames (void)
|
|||
|
||||
fprintf (Gbl.F.Out,"</th>");
|
||||
}
|
||||
|
||||
fprintf (Gbl.F.Out,"<th class=\"RIGHT_MIDDLE\">%s</th>",Txt_Matches);
|
||||
|
||||
fprintf (Gbl.F.Out,"</tr>");
|
||||
|
||||
/***** Write all the games *****/
|
||||
|
@ -366,6 +372,7 @@ void Gam_ShowOneGame (long GamCod,
|
|||
extern const char *Txt_Today;
|
||||
extern const char *Txt_View_game;
|
||||
extern const char *Txt_No_of_questions;
|
||||
extern const char *Txt_Matches;
|
||||
char *Anchor = NULL;
|
||||
static unsigned UniqueId = 0;
|
||||
struct Game Game;
|
||||
|
@ -467,6 +474,24 @@ void Gam_ShowOneGame (long GamCod,
|
|||
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** Number of matches in game *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"RIGHT_TOP");
|
||||
if (!ShowOnlyThisGame)
|
||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||
fprintf (Gbl.F.Out,"\">");
|
||||
|
||||
Frm_StartForm (ActSeeGam);
|
||||
Gam_PutParamGameCod (GamCod);
|
||||
Frm_LinkFormSubmit (Txt_Matches,
|
||||
Game.Status.Visible ? "ASG_TITLE" :
|
||||
"ASG_TITLE_LIGHT",NULL);
|
||||
if (ShowOnlyThisGame)
|
||||
fprintf (Gbl.F.Out,"%s: ",Txt_Matches);
|
||||
fprintf (Gbl.F.Out,"%u</a>",Game.NumMchs);
|
||||
Frm_EndForm ();
|
||||
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** End 1st row of this game *****/
|
||||
fprintf (Gbl.F.Out,"</tr>");
|
||||
|
||||
|
@ -482,7 +507,7 @@ void Gam_ShowOneGame (long GamCod,
|
|||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/***** Text of the game *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP");
|
||||
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"LEFT_TOP");
|
||||
if (!ShowOnlyThisGame)
|
||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||
fprintf (Gbl.F.Out,"\">");
|
||||
|
@ -699,6 +724,9 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
|
|||
/* Get number of questions */
|
||||
Game->NumQsts = Gam_GetNumQstsGame (Game->GamCod);
|
||||
|
||||
/* Get number of matches */
|
||||
Game->NumMchs = Gam_GetNumMchsGame (Game->GamCod);
|
||||
|
||||
/* Can I view results of the game?
|
||||
Can I edit game? */
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
|
@ -730,16 +758,8 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Initialize to empty game */
|
||||
Game->GamCod = -1L;
|
||||
Game->UsrCod = -1L;
|
||||
Game->Title[0] = '\0';
|
||||
Game->NumQsts = 0;
|
||||
Game->Status.Visible = true;
|
||||
Game->Status.ICanViewResults = false;
|
||||
Game->Status.ICanEdit = false;
|
||||
}
|
||||
Gam_ResetGame (Game,-1L);
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -775,6 +795,25 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Initialize game to empty ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Gam_ResetGame (struct Game *Game,long UsrCod)
|
||||
{
|
||||
/***** Initialize to empty game *****/
|
||||
Game->GamCod = -1L;
|
||||
Game->UsrCod = UsrCod;
|
||||
Game->TimeUTC[Dat_START_TIME] = (time_t) 0;
|
||||
Game->TimeUTC[Dat_END_TIME ] = (time_t) 0;
|
||||
Game->Title[0] = '\0';
|
||||
Game->NumQsts = 0;
|
||||
Game->NumMchs = 0;
|
||||
Game->Status.Visible = true;
|
||||
Game->Status.ICanViewResults = false;
|
||||
Game->Status.ICanEdit = false;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Free list of games ****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1029,14 +1068,7 @@ void Gam_RequestCreatOrEditGame (void)
|
|||
Lay_ShowErrorAndExit ("You can not create a new game here.");
|
||||
|
||||
/* Initialize to empty game */
|
||||
Game.GamCod = -1L;
|
||||
Game.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
Game.TimeUTC[Dat_START_TIME] = (time_t) 0;
|
||||
Game.TimeUTC[Dat_END_TIME ] = (time_t) 0;
|
||||
Game.Title[0] = '\0';
|
||||
Game.NumQsts = 0;
|
||||
Game.Status.Visible = true;
|
||||
Game.Status.ICanViewResults = false;
|
||||
Gam_ResetGame (&Game,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@ struct Game
|
|||
char Title[Gam_MAX_BYTES_TITLE + 1];
|
||||
time_t TimeUTC[Dat_NUM_START_END_TIME];
|
||||
unsigned NumQsts; // Number of questions in the game
|
||||
unsigned NumMchs; // Number of matches in the game
|
||||
struct
|
||||
{
|
||||
bool Visible; // Game is not hidden
|
||||
|
|
14
swad_match.c
14
swad_match.c
|
@ -1976,6 +1976,20 @@ static void Mch_ShowMatchStatusForStd (struct Match *Match)
|
|||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get number of questions of a game *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Gam_GetNumMchsGame (long GamCod)
|
||||
{
|
||||
/***** Get number of matches in a game from database *****/
|
||||
return
|
||||
(unsigned) DB_QueryCOUNT ("can not get number of matches of a game",
|
||||
"SELECT COUNT(*) FROM mch_matches"
|
||||
" WHERE GamCod=%ld",
|
||||
GamCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Check if I belong to any of the groups of a match **************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -58,6 +58,8 @@ void Mch_ToggleVisibilResultsMchQst (void);
|
|||
void Mch_BackMatchTch (void);
|
||||
void Mch_ForwardMatchTch (void);
|
||||
|
||||
unsigned Gam_GetNumMchsGame (long GamCod);
|
||||
|
||||
void Mch_GetMatchBeingPlayed (void);
|
||||
void Mch_ShowMatchToMeAsStd (void);
|
||||
void Mch_RefreshMatchTch (void);
|
||||
|
|
Loading…
Reference in New Issue