diff --git a/swad_changelog.h b/swad_changelog.h index 63226ffb4..5767256c7 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -469,12 +469,14 @@ Type of answer not valid in a game. */ -#define Log_PLATFORM_VERSION "SWAD 19.5 (2019-09-17)" +#define Log_PLATFORM_VERSION "SWAD 19.5.2 (2019-09-17)" #define CSS_FILE "swad19.3.css" #define JS_FILE "swad18.130.2.js" /* + Version 19.5.2: Sep 17, 2019 New column with number of players in listing of matches of a game. (244711 lines) + Version 19.5.1: Sep 17, 2019 Removed icon to play a new match in a game. (244685 lines) Version 19.5: Sep 17, 2019 Fixed bugs related with edition of games. - Fixed bugs related with behaviour of matches. (244691 lines) + Fixed bugs related with behaviour of matches. (244691 lines) 2 changes necessary in database: ALTER TABLE mch_matches DROP COLUMN Showing; ALTER TABLE mch_matches ADD COLUMN Showing ENUM('nothing','stem','answers','results') NOT NULL DEFAULT 'nothing' AFTER ShowResults; diff --git a/swad_game.c b/swad_game.c index f25b90bf3..c6eca609e 100644 --- a/swad_game.c +++ b/swad_game.c @@ -351,7 +351,6 @@ 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_New_match; char *Anchor = NULL; static unsigned UniqueId = 0; struct Game Game; @@ -388,13 +387,6 @@ void Gam_ShowOneGame (long GamCod, /* Icons to remove/edit this game */ Gam_PutFormsToRemEditOneGame (&Game,Anchor); - if (ShowOnlyThisGame) - /* Icon to start a new match */ - Lay_PutContextualLinkOnlyIcon (ActReqNewMchTch,Mch_NEW_MATCH_SECTION_ID, - Gam_PutParams, - "play.svg", - Txt_New_match); - fprintf (Gbl.F.Out,""); } diff --git a/swad_match.c b/swad_match.c index 98da257aa..85ff2a4d8 100644 --- a/swad_match.c +++ b/swad_match.c @@ -192,6 +192,7 @@ static void Mch_GetNumPlayers (struct Match *Match); static int Mch_GetQstAnsFromDB (long MchCod,unsigned QstInd); static unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsigned AnsInd); +static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod); static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQst,bool Correct); /*****************************************************************************/ @@ -358,6 +359,7 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game, extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; extern const char *Txt_Match; + extern const char *Txt_Players; extern const char *Txt_Status; extern const char *Txt_Play; extern const char *Txt_Resume; @@ -388,12 +390,16 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game, "" "%s" "" + "" + "%s" + "" "", Txt_No_INDEX, Txt_ROLES_SINGUL_Abc[Rol_TCH][Usr_SEX_UNKNOWN], Txt_START_END_TIME[Gam_ORDER_BY_START_DATE], Txt_START_END_TIME[Gam_ORDER_BY_END_DATE], Txt_Match, + Txt_Players, Txt_Status); /***** Write rows *****/ @@ -471,6 +477,13 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game, fprintf (Gbl.F.Out,""); + /***** Number of players who have answered any question in the match ******/ + fprintf (Gbl.F.Out,"" + "%u" + "", + Gbl.RowEvenOdd, + Mch_GetNumUsrsWhoHaveAnswerMch (Match.MchCod)); + /***** Match status ******/ fprintf (Gbl.F.Out,"",Gbl.RowEvenOdd); @@ -2330,7 +2343,7 @@ void Mch_GetAndDrawBarNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsig unsigned Mch_GetNumUsrsWhoHaveAnswerQst (long MchCod,unsigned QstInd) { /***** Get number of users who have answered - a question in a match from database *****/ + a question in match from database *****/ return (unsigned) DB_QueryCOUNT ("can not get number of users who hasve answered a question", "SELECT COUNT(*) FROM mch_answers" @@ -2353,6 +2366,21 @@ static unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsi MchCod,QstInd,AnsInd); } +/*****************************************************************************/ +/****** Get number of users who have answered any question in a match ********/ +/*****************************************************************************/ + +static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod) + { + /***** Get number of users who have answered + any question in match from database *****/ + return + (unsigned) DB_QueryCOUNT ("can not get number of users who hasve answered a match", + "SELECT COUNT(DISTINCT UsrCod) FROM mch_answers" + " WHERE MchCod=%ld", + MchCod); + } + /*****************************************************************************/ /***************** Draw a bar with the percentage of answers *****************/ /*****************************************************************************/