diff --git a/css/swad18.136.css b/css/swad18.136.4.css similarity index 99% rename from css/swad18.136.css rename to css/swad18.136.4.css index ac3cd5f3..fa3b27a6 100644 --- a/css/swad18.136.css +++ b/css/swad18.136.4.css @@ -2571,6 +2571,24 @@ a:hover img.CENTRE_PHOTO_SHOW margin:4%; width:92%; } +.MATCH_LEFT + { + box-sizing:border-box; + float:left; + width:25%; + white-space:nowrap; + overflow:hidden; + text-overflow:ellipsis; + border:1px solid red; + } +.MATCH_RIGHT + { + box-sizing:border-box; + display:table; + float:left; + width:75%; + border:1px solid blue; + } .MATCH_TOP { box-sizing:border-box; @@ -2578,7 +2596,7 @@ a:hover img.CENTRE_PHOTO_SHOW width:100%; font-size:18pt; padding-bottom:18pt; - /* border:1px solid pink; */ + border:1px solid pink; } .MATCH_TOP_LEFT { @@ -2588,7 +2606,7 @@ a:hover img.CENTRE_PHOTO_SHOW white-space:nowrap; overflow:hidden; text-overflow:ellipsis; - /* border:1px solid red; */ + border:1px solid red; } .MATCH_TOP_RIGHT { @@ -2596,40 +2614,31 @@ a:hover img.CENTRE_PHOTO_SHOW float:left; width:40%; text-align:right; - /* border:1px solid blue; */ + border:1px solid blue; } .MATCH_BOTTOM { box-sizing:border-box; width:100%; - /* border:1px solid pink; */ - } -.MATCH_BOTTOM_LEFT - { - box-sizing:border-box; - float:left; - width:20%; - white-space:nowrap; - overflow:hidden; - text-overflow:ellipsis; - /* border:1px solid red; */ - } -.MATCH_BOTTOM_RIGHT - { - box-sizing:border-box; - float:left; - width:80%; - /* border:1px solid blue; */ + border:1px solid pink; } -.MATCH_TCH_NUM_QST +.MATCH_NUM_QST { text-align:center; - padding-bottom:24pt; + padding:48pt 0; color:#808080; font-size:36pt; font-weight:bold; } +.MATCH_NUM_ANSWERERS + { + text-align:center; + padding:16pt 0; + color:#808080; + font-size:16pt; + } + .MATCH_TCH_NXT_CONTAINER { } @@ -2664,15 +2673,6 @@ a:hover img.CENTRE_PHOTO_SHOW width:50%; } -.MATCH_STD_NUM_QST - { - width:15%; - float:left; - padding-bottom:24pt; - color:#808080; - font-size:36pt; - font-weight:bold; - } .MATCH_STD_QST_CONTAINER { width:85%; diff --git a/icon/list.svg b/icon/list.svg new file mode 100644 index 00000000..4dc87af7 --- /dev/null +++ b/icon/list.svg @@ -0,0 +1 @@ + diff --git a/swad_changelog.h b/swad_changelog.h index 999c4d7e..0705281c 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -458,10 +458,15 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.136.2 (2019-07-18)" -#define CSS_FILE "swad18.136.css" +#define Log_PLATFORM_VERSION "SWAD 18.136.4 (2019-07-19)" +#define CSS_FILE "swad18.136.4.css" #define JS_FILE "swad18.130.2.js" /* + Version 18.136.4: Jul 19, 2019 Changes in layout of match for teachers. (243920 lines) + Version 18.136.3: Jul 19, 2019 New icon to see answers in a match. (243924 lines) + Copy the following icon to icon public directory: +sudo cp icon/list.svg /var/www/html/swad/icon/ + Version 18.136.2: Jul 18, 2019 Changes in layout of match. (243895 lines) Version 18.136.1: Jul 18, 2019 Changes in layout of match. (243853 lines) Version 18.136: Jul 18, 2019 Changes in layout of match. (243767 lines) diff --git a/swad_game.c b/swad_game.c index 9f9b221b..8d20dfea 100644 --- a/swad_game.c +++ b/swad_game.c @@ -163,6 +163,7 @@ static void Gam_AllocateListSelectedQuestions (void); static void Gam_FreeListsSelectedQuestions (void); static unsigned Gam_CountNumQuestionsInList (void); +static unsigned Gam_GetNumAnswerers (struct Match *Match); static unsigned Gam_GetNumUsrsWhoAnswered (long GamCod,unsigned QstInd,unsigned AnsInd); static void Gam_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs); @@ -188,7 +189,7 @@ static void Gam_UpdateMatchStatusInDB (struct Match *Match); static void Gam_SetMatchStatusToNextQuestion (struct Match *Match); static void Gam_ShowMatchStatusForTch (struct Match *Match); static void Gam_ShowMatchStatusForStd (struct Match *Match); -static void Gam_ShowBottonLeftColumnTch (struct Match *Match); +static void Gam_ShowBottonLeftColumnTch (struct Match *Match,unsigned NumPlayers); static void Gam_ShowBottonLeftColumnStd (struct Match *Match); static void Gam_ShowQuestionAndAnswersTch (struct Match *Match); static void Gam_ShowQuestionAndAnswersStd (struct Match *Match); @@ -202,7 +203,6 @@ static void Gam_UpdateMatchAsBeingPlayed (long MchCod); static void Gam_SetMatchAsNotBeingPlayed (long MchCod); static bool Gam_GetIfMatchIsBeingPlayed (long MchCod); static void Gam_RegisterMeAsPlayerInMatch (long MchCod); -static void Gam_GetAndShowNumPlayersInMatch (long MchCod); static unsigned Gam_GetNumPlayers (long MchCod); static void Gam_ShowMatchStatusForStd (struct Match *Match); @@ -1667,7 +1667,7 @@ static bool Gam_CheckIfIPlayThisMatchBasedOnGrps (long MchCod) static unsigned Gam_GetNumQstsGame (long GamCod) { - /***** Get data of questions from database *****/ + /***** Get nuumber of questions in a game from database *****/ return (unsigned) DB_QueryCOUNT ("can not get number of questions of a game", "SELECT COUNT(*) FROM gam_questions" @@ -2308,6 +2308,20 @@ void Gam_GetAndDrawBarNumUsrsWhoAnswered (long GamCod,unsigned QstInd,unsigned A Gam_DrawBarNumUsrs (NumUsrsThisAnswer,NumUsrs); } +/*****************************************************************************/ +/***** Get number of users who have answered current question in a match *****/ +/*****************************************************************************/ + +static unsigned Gam_GetNumAnswerers (struct Match *Match) + { + /***** Get number of users who have answered the current question in a match from database *****/ + return + (unsigned) DB_QueryCOUNT ("can not get number of questions of a game", + "SELECT COUNT(*) FROM gam_answers" + " WHERE MchCod=%ld AND QstInd=%u", + Match->MchCod,Match->Status.QstInd); + } + /*****************************************************************************/ /**** Get number of users who selected a given answer of a game question *****/ /*****************************************************************************/ @@ -3456,6 +3470,16 @@ static void Gam_SetMatchStatusToNextQuestion (struct Match *Match) static void Gam_ShowMatchStatusForTch (struct Match *Match) { + extern const char *Txt_Players; + unsigned NumPlayers = Gam_GetNumPlayers (Match->MchCod); + + /***** Left column *****/ + Gam_ShowBottonLeftColumnTch (Match,NumPlayers); + + /***** Right column *****/ + /* Start right container */ + fprintf (Gbl.F.Out,"
"); + /***** Top row *****/ /* Start top container */ fprintf (Gbl.F.Out,"
"); @@ -3467,9 +3491,8 @@ static void Gam_ShowMatchStatusForTch (struct Match *Match) Match->Title); /* Right: Number of players */ - fprintf (Gbl.F.Out,"
"); - Gam_GetAndShowNumPlayersInMatch (Match->MchCod); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
%s: %u
", + Txt_Players,NumPlayers); /* End top container */ fprintf (Gbl.F.Out,"
"); @@ -3478,9 +3501,6 @@ static void Gam_ShowMatchStatusForTch (struct Match *Match) /* Start bottom container */ fprintf (Gbl.F.Out,"
"); - /* Show left column */ - Gam_ShowBottonLeftColumnTch (Match); - /* Show right column */ fprintf (Gbl.F.Out,"
"); if (!Match->Status.Finished && @@ -3496,6 +3516,9 @@ static void Gam_ShowMatchStatusForTch (struct Match *Match) /* End bottom container */ fprintf (Gbl.F.Out,"
"); + + /* End right container */ + fprintf (Gbl.F.Out,"
"); } /*****************************************************************************/ @@ -3550,7 +3573,7 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match) /******** Show left botton column when playing a match (as a teacher) ********/ /*****************************************************************************/ -static void Gam_ShowBottonLeftColumnTch (struct Match *Match) +static void Gam_ShowBottonLeftColumnTch (struct Match *Match,unsigned NumPlayers) { extern const char *Txt_End; extern const char *Txt_Next_QUESTION; @@ -3560,13 +3583,14 @@ static void Gam_ShowBottonLeftColumnTch (struct Match *Match) extern const char *Txt_Resume; unsigned NxtQstInd; unsigned NumQsts; + unsigned NumAnswerers; - /***** Start bottom left container *****/ - fprintf (Gbl.F.Out,"
"); + /***** Start left container *****/ + fprintf (Gbl.F.Out,"
"); /***** Write number of question *****/ NumQsts = Gam_GetNumQstsGame (Match->GamCod); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); if (Match->Status.Finished) fprintf (Gbl.F.Out,"%s",Txt_End); else @@ -3599,7 +3623,7 @@ static void Gam_ShowBottonLeftColumnTch (struct Match *Match) else /* Put button to show answers */ Gam_PutBigButton (ActNxtMchTch,Match->MchCod, - "step-forward.svg",Txt_Answers); + "list.svg",Txt_Answers); } else /* Put button to start / resume match */ @@ -3611,7 +3635,20 @@ static void Gam_ShowBottonLeftColumnTch (struct Match *Match) fprintf (Gbl.F.Out,"
" "
"); - /***** End bottom left container *****/ + /***** Write number of users who have answered *****/ + if (!Match->Status.Finished && + Match->Status.BeingPlayed && + Match->Status.ShowingAnswers) + { + NumAnswerers = Gam_GetNumAnswerers (Match); + fprintf (Gbl.F.Out,"
" + "responden
" // TODO: Need translation!!! + "%u/%u" + "
", + NumAnswerers,NumPlayers); + } + + /***** End left container *****/ fprintf (Gbl.F.Out,"
"); } @@ -3629,7 +3666,7 @@ static void Gam_ShowBottonLeftColumnStd (struct Match *Match) /***** Write number of question *****/ NumQsts = Gam_GetNumQstsGame (Match->GamCod); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); if (Match->Status.Finished) fprintf (Gbl.F.Out,"%s",Txt_End); else @@ -3928,18 +3965,6 @@ static void Gam_RegisterMeAsPlayerInMatch (long MchCod) MchCod,Gbl.Usrs.Me.UsrDat.UsrCod); } -static void Gam_GetAndShowNumPlayersInMatch (long MchCod) - { - extern const char *Txt_Players; - unsigned NumPlayers; - - /***** Get number of players (students who have joined this match) *****/ - NumPlayers = Gam_GetNumPlayers (MchCod); - - /***** Show number of players *****/ - fprintf (Gbl.F.Out,"%s: %u",Txt_Players,NumPlayers); - } - static unsigned Gam_GetNumPlayers (long MchCod) { /***** Get number of players who are playing a match *****/