diff --git a/css/swad18.138.css b/css/swad18.138.css index f2353442d..43a497495 100644 --- a/css/swad18.138.css +++ b/css/swad18.138.css @@ -2579,7 +2579,6 @@ a:hover img.CENTRE_PHOTO_SHOW white-space:nowrap; overflow:hidden; text-overflow:ellipsis; - border:1px solid red; } .MATCH_RIGHT { @@ -2587,34 +2586,40 @@ a:hover img.CENTRE_PHOTO_SHOW display:table; float:left; width:75%; - border:1px solid blue; } .MATCH_TOP { box-sizing:border-box; width:100%; height:60px; + color:#808080; font-size:18pt; + font-weight:bold; text-align:center; text-overflow:ellipsis; - border:1px solid pink; } .MATCH_BOTTOM { box-sizing:border-box; width:100%; - border:1px solid pink; + padding-left:24px; } .MATCH_NUM_QST { - text-align:center; - vertical-align:top; - padding-bottom:48pt; color:#808080; font-size:36pt; font-weight:bold; - border:1px solid green; + text-align:center; + vertical-align:top; + } +.MATCH_TIME_QST + { + color:#808080; + font-size:18pt; + font-weight:bold; + text-align:center; + vertical-align:top; } .MATCH_NUM_PLAYERS { @@ -2642,24 +2647,21 @@ a:hover img.CENTRE_PHOTO_SHOW display:table-cell; box-sizing:border-box; float:left; - width:33%; - /* border:1px solid green; */ + width:35%; } .MATCH_BUTTON_CENTER_CONTAINER { display:table-cell; box-sizing:border-box; float:left; - width:34%; - /* border:1px solid green; */ + width:30%; } .MATCH_BUTTON_RIGHT_CONTAINER { display:table-cell; box-sizing:border-box; float:left; - width:33%; - /* border:1px solid green; */ + width:35%; } .MATCH_BUTTON_CONTAINER @@ -2667,8 +2669,8 @@ a:hover img.CENTRE_PHOTO_SHOW box-sizing:border-box; display:table; width:100%; - height:100px; - vertical-align:middle; + height:128px; + font-size:36pt; } .MATCH_BUTTON_CONTAINER a { @@ -2679,10 +2681,8 @@ a:hover img.CENTRE_PHOTO_SHOW { display:table-cell; width:100%; - font-size:48pt; text-align:center; vertical-align:middle; - /* margin:auto; */ opacity:0.7; } .MATCH_BUTTON_ON:hover @@ -2693,10 +2693,8 @@ a:hover img.CENTRE_PHOTO_SHOW { display:table-cell; width:100%; - font-size:48pt; text-align:center; vertical-align:middle; - /* margin:auto; */ opacity:0.1; } @@ -2743,7 +2741,6 @@ a:hover img.CENTRE_PHOTO_SHOW { text-align:center; vertical-align:middle; - border:1px solid green; } .MATCH_STD_BUTTON { diff --git a/swad_changelog.h b/swad_changelog.h index 6624b8cce..ac9605b13 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -460,10 +460,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.141 (2019-09-09)" +#define Log_PLATFORM_VERSION "SWAD 18.141.1 (2019-09-09)" #define CSS_FILE "swad18.138.css" #define JS_FILE "swad18.130.2.js" /* + Version 18.141.1: Sep 09, 2019 Display question elapsed time. (244329 lines) Version 18.141: Sep 09, 2019 New action to pause a match. (244312 lines) 1 change necessary in database: INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1791','es','N','Pausar partida (como profesor)'); diff --git a/swad_date.c b/swad_date.c index 974b314b9..1f0b0709b 100644 --- a/swad_date.c +++ b/swad_date.c @@ -1559,7 +1559,6 @@ void Dat_WriteScriptMonths (void) /*****************************************************************************/ /********* Write time difference in seconds as hours:minutes:seconds *********/ /*****************************************************************************/ -// TimeDiff must be in seconds void Dat_WriteHoursMinutesSecondsFromSeconds (time_t Seconds) { @@ -1581,3 +1580,22 @@ void Dat_WriteHoursMinutesSecondsFromSeconds (time_t Seconds) (long) Seconds); } +/*****************************************************************************/ +/******************* Write time as hours:minutes:seconds *********************/ +/*****************************************************************************/ + +void Dat_WriteHoursMinutesSeconds (struct Time *Time) + { + if (Time->Hour) + fprintf (Gbl.F.Out,"%u:%02u'%02u"", + Time->Hour, + Time->Minute, + Time->Second); + else if (Time->Minute) + fprintf (Gbl.F.Out,"%u'%02u"", + Time->Minute, + Time->Second); + else + fprintf (Gbl.F.Out,"%u"", + Time->Second); + } diff --git a/swad_date.h b/swad_date.h index be9b07e40..6ee957c7f 100644 --- a/swad_date.h +++ b/swad_date.h @@ -191,5 +191,6 @@ void Dat_AssignDate (struct Date *DateDst,struct Date *DateSrc); void Dat_WriteScriptMonths (void); void Dat_WriteHoursMinutesSecondsFromSeconds (time_t Seconds); +void Dat_WriteHoursMinutesSeconds (struct Time *Time); #endif diff --git a/swad_game.c b/swad_game.c index 919c8991c..1a6c76fd5 100644 --- a/swad_game.c +++ b/swad_game.c @@ -209,11 +209,11 @@ static void Gam_UpdateMatchStatusInDB (struct Match *Match); static void Gam_UpdateElapsedTimeInQuestion (struct Match *Match); static void Gam_GetElapsedTimeInQuestion (struct Match *Match, - char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]); + struct Time *Time); static void Gam_GetElapsedTimeInMatch (struct Match *Match, - char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]); + struct Time *Time); static void Gam_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res, - char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]); + struct Time *Time); static void Gam_SetMatchStatusToPrevQuestion (struct Match *Match); static void Gam_SetMatchStatusToNextQuestion (struct Match *Match); @@ -3396,7 +3396,7 @@ static void Gam_UpdateElapsedTimeInQuestion (struct Match *Match) /*****************************************************************************/ static void Gam_GetElapsedTimeInQuestion (struct Match *Match, - char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]) + struct Time *Time) { MYSQL_RES *mysql_res; unsigned NumRows; @@ -3409,7 +3409,7 @@ static void Gam_GetElapsedTimeInQuestion (struct Match *Match, Match->MchCod,Match->Status.QstInd); /***** Get elapsed time from query result *****/ - Gam_GetElapsedTime (NumRows,mysql_res,HHHMMSS); + Gam_GetElapsedTime (NumRows,mysql_res,Time); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -3420,7 +3420,7 @@ static void Gam_GetElapsedTimeInQuestion (struct Match *Match, /*****************************************************************************/ static void Gam_GetElapsedTimeInMatch (struct Match *Match, - char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]) + struct Time *Time) { MYSQL_RES *mysql_res; unsigned NumRows; @@ -3432,7 +3432,7 @@ static void Gam_GetElapsedTimeInMatch (struct Match *Match, Match->MchCod); /***** Get elapsed time from query result *****/ - Gam_GetElapsedTime (NumRows,mysql_res,HHHMMSS); + Gam_GetElapsedTime (NumRows,mysql_res,Time); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -3443,31 +3443,27 @@ static void Gam_GetElapsedTimeInMatch (struct Match *Match, /*****************************************************************************/ static void Gam_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res, - char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]) + struct Time *Time) { MYSQL_ROW row; bool ElapsedTimeGotFromDB = false; + /***** Get time from H...H:MM:SS string *****/ if (NumRows) { row = mysql_fetch_row (mysql_res); if (row[0]) - { /* Get the elapsed time (row[0]) */ - if (strlen (row[0]) > 2 + 1 + 2 + 1 + 2) - Str_Copy (HHHMMSS,"+99:59:59", - Gam_MAX_BYTES_TITLE); - else - Str_Copy (HHHMMSS,row[0], - Gam_MAX_BYTES_TITLE); - ElapsedTimeGotFromDB = true; - } + if (sscanf (row[0],"%u:%02u:%02u",&Time->Hour,&Time->Minute,&Time->Second) == 3) + ElapsedTimeGotFromDB = true; } + /***** Initialize time to default value (0) *****/ if (!ElapsedTimeGotFromDB) - Str_Copy (HHHMMSS,"00:00:00", - Gam_MAX_BYTES_TITLE); + Time->Hour = + Time->Minute = + Time->Second = 0; } /*****************************************************************************/ @@ -3752,7 +3748,7 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) extern const char *Txt_Next_QUESTION; extern const char *Txt_Finish; extern const char *Txt_Answers; - char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]; + struct Time Time; unsigned PrvQstInd; // Previous question index unsigned NxtQstInd; // Next question index unsigned NumAnswerers; @@ -3764,14 +3760,20 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) fprintf (Gbl.F.Out,"
"); /* Write elapsed time in match */ - Gam_GetElapsedTimeInMatch (Match,HHHMMSS); - fprintf (Gbl.F.Out,"%s",HHHMMSS); + Gam_GetElapsedTimeInMatch (Match,&Time); + Dat_WriteHoursMinutesSeconds (&Time); fprintf (Gbl.F.Out,"
"); /***** Write number of question *****/ Gam_ShowNumQstInGame (Match); + /***** Write elapsed time in question *****/ + fprintf (Gbl.F.Out,"
"); + Gam_GetElapsedTimeInQuestion (Match,&Time); + Dat_WriteHoursMinutesSeconds (&Time); + fprintf (Gbl.F.Out,"
"); + /***** Buttons *****/ /* Start buttons container */ fprintf (Gbl.F.Out,"
");