diff --git a/css/swad18.132.2.css b/css/swad18.132.2.css
index 717193463..650dd996b 100644
--- a/css/swad18.132.2.css
+++ b/css/swad18.132.2.css
@@ -2686,11 +2686,13 @@ a:hover img.CENTRE_PHOTO_SHOW
{
box-shadow: 0px 0px 18px 12px rgba(0,128,0,1);
}
+/*
.GAM_PLAY_TCH_BUTTON:hover, .GAM_PLAY_STD_BUTTON:hover
{
- background-image:-webkit-linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2)); /* Safari */
+ background-image:-webkit-linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2)); Safari
background-image:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2));
}
+*/
.BT_A {background-color:#e21c3d; border-color:#a9152d;} /* red */
.BT_B {background-color:#1369ce; border-color:#0e519c;} /* blue */
diff --git a/sql/swad.sql b/sql/swad.sql
index 6c7488863..ca690f70e 100644
--- a/sql/swad.sql
+++ b/sql/swad.sql
@@ -668,13 +668,6 @@ CREATE TABLE IF NOT EXISTS gam_questions (
INDEX(GamCod),
INDEX(QstCod));
--
--- Table gam_users: stores the users who have answer the games
---
-CREATE TABLE IF NOT EXISTS gam_users (
- GamCod INT NOT NULL,
- UsrCod INT NOT NULL,
- UNIQUE INDEX(GamCod,UsrCod));
---
-- Table hidden_params: stores some hidden parameters passed from a page to another using database instead of forms
--
CREATE TABLE IF NOT EXISTS hidden_params (
diff --git a/swad_changelog.h b/swad_changelog.h
index 7b7efc38a..b1f81f73e 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -458,10 +458,23 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 18.135.1 (2019-07-17)"
+#define Log_PLATFORM_VERSION "SWAD 18.135.3 (2019-07-17)"
#define CSS_FILE "swad18.132.2.css"
#define JS_FILE "swad18.130.2.js"
/*
+ Version 18.135.3: Jul 17, 2019 Removed unused code in games.
+ Optimization in match buttons. (243668 lines)
+ 8 changes necessary in database:
+DROP TABLE IF EXISTS gam_users;
+Only if you use MyISAM:
+ALTER TABLE games ENGINE=MyISAM;
+ALTER TABLE gam_answers ENGINE=MyISAM;
+ALTER TABLE gam_grp ENGINE=MyISAM;
+ALTER TABLE gam_matches ENGINE=MyISAM;
+ALTER TABLE gam_mch_being_played ENGINE=MyISAM;
+ALTER TABLE gam_players ENGINE=MyISAM;
+ALTER TABLE gam_questions ENGINE=MyISAM;
+
Version 18.135.1: Jul 17, 2019 When a teacher resumes a match, no answers are shown. (243708 lines)
Version 18.135: Jul 17, 2019 A match is put in pause for students when the teacher closes the tab. (243707 lines)
1 change necessary in database:
diff --git a/swad_database.c b/swad_database.c
index fc190e789..f3eee7d64 100644
--- a/swad_database.c
+++ b/swad_database.c
@@ -1454,22 +1454,6 @@ mysql> DESCRIBE gam_questions;
"INDEX(GamCod),"
"INDEX(QstCod))");
- /***** Table gam_users *****/
-/*
-mysql> DESCRIBE gam_users;
-+--------+---------+------+-----+---------+-------+
-| Field | Type | Null | Key | Default | Extra |
-+--------+---------+------+-----+---------+-------+
-| SvyCod | int(11) | NO | PRI | NULL | |
-| UsrCod | int(11) | NO | PRI | NULL | |
-+--------+---------+------+-----+---------+-------+
-2 rows in set (0.00 sec)
-*/
- DB_CreateTable ("CREATE TABLE IF NOT EXISTS gam_users ("
- "GamCod INT NOT NULL,"
- "UsrCod INT NOT NULL,"
- "UNIQUE INDEX(GamCod,UsrCod))");
-
/***** Table hidden_params *****/
/*
mysql> DESCRIBE hidden_params;
diff --git a/swad_game.c b/swad_game.c
index 7dbb63943..c80cec93e 100644
--- a/swad_game.c
+++ b/swad_game.c
@@ -203,8 +203,6 @@ static unsigned Gam_GetNumPlayers (long MchCod);
static void Gam_ShowMatchStatusForStd (struct Match *Match);
static int Gam_GetQstAnsFromDB (long MchCod,unsigned QstInd);
-static unsigned Gam_GetNumUsrsWhoHaveAnsweredGame (long GamCod);
-
/*****************************************************************************/
/*************************** List all the games ******************************/
/*****************************************************************************/
@@ -430,7 +428,6 @@ static 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_No_of_users;
extern const char *Txt_New_match;
char *Anchor = NULL;
static unsigned UniqueId = 0;
@@ -535,14 +532,12 @@ static void Gam_ShowOneGame (long GamCod,
Frm_EndForm ();
Lay_EndArticle ();
- /* Number of questions and number of distinct students who have already answered */
- fprintf (Gbl.F.Out,"
%s: %u; %s: %u
",
+ /* Number of questions */
+ fprintf (Gbl.F.Out,"
%s: %u
",
Game.Status.Visible ? "ASG_GRP" :
"ASG_GRP_LIGHT",
Txt_No_of_questions,
- Game.NumQsts,
- Txt_No_of_users,
- Game.NumUsrs);
+ Game.NumQsts);
fprintf (Gbl.F.Out,"");
@@ -788,9 +783,8 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
Str_Copy (Game->Title,row[3],
Gam_MAX_BYTES_TITLE);
- /* Get number of questions and number of users who have already answer this game */
+ /* Get number of questions */
Game->NumQsts = Gam_GetNumQstsGame (Game->GamCod);
- Game->NumUsrs = Gam_GetNumUsrsWhoHaveAnsweredGame (Game->GamCod);
/* Can I view results of the game?
Can I edit game? */
@@ -830,7 +824,6 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
Game->UsrCod = -1L;
Game->Title[0] = '\0';
Game->NumQsts = 0;
- Game->NumUsrs = 0;
Game->Status.Visible = true;
Game->Status.ICanViewResults = false;
Game->Status.ICanEdit = false;
@@ -1018,11 +1011,6 @@ void Gam_RemoveGame (void)
if (!Game.Status.ICanEdit)
Lay_ShowErrorAndExit ("You can not remove this game.");
- /***** Remove all the users in this game *****/
- DB_QueryDELETE ("can not remove users who are answered a game",
- "DELETE FROM gam_users WHERE GamCod=%ld",
- Game.GamCod);
-
/***** Remove all the questions in this game *****/
DB_QueryDELETE ("can not remove questions of a game",
"DELETE FROM gam_questions WHERE GamCod=%ld",
@@ -1108,11 +1096,6 @@ void Gam_ResetGame (void)
if (!Game.Status.ICanEdit)
Lay_ShowErrorAndExit ("You can not reset this game.");
- /***** Remove all the users in this game *****/
- DB_QueryDELETE ("can not remove users who are answered a game",
- "DELETE FROM gam_users WHERE GamCod=%ld",
- Game.GamCod);
-
/***** Reset all the answers in this game *****/
DB_QueryUPDATE ("can not reset answers of a game",
"UPDATE gam_answers,gam_questions"
@@ -1237,7 +1220,6 @@ void Gam_RequestCreatOrEditGame (void)
Game.TimeUTC[Gam_END_TIME ] = (time_t) 0;
Game.Title[0] = '\0';
Game.NumQsts = 0;
- Game.NumUsrs = 0;
Game.Status.Visible = true;
Game.Status.Open = true;
Game.Status.ICanViewResults = false;
@@ -1623,15 +1605,6 @@ static void Gam_GetAndWriteNamesOfGrpsAssociatedToMatch (struct Match *Match)
void Gam_RemoveGames (Hie_Level_t Scope,long Cod)
{
- /***** Remove all the users in course games *****/
- DB_QueryDELETE ("can not remove users who had answered games"
- " in a place on the hierarchy",
- "DELETE FROM gam_users"
- " USING games,gam_users"
- " WHERE games.Scope='%s' AND games.Cod=%ld"
- " AND games.GamCod=gam_users.GamCod",
- Sco_GetDBStrFromScope (Scope),Cod);
-
/***** Remove all the answers in course games *****/
DB_QueryDELETE ("can not remove answers of games"
" in a place on the hierarchy"
@@ -3900,18 +3873,23 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match)
/* Start table cell */
fprintf (Gbl.F.Out,"
");
- /* Form with button */
+ /* Form with button.
+ Sumitting onmousedown instead of default onclick
+ is necessary in order to be fast
+ and not lose clicks due to refresh */
Frm_StartForm (ActAnsMchQstStd);
Gam_PutParamMatchCod (Match->MchCod); // Current match being played
Gam_PutParamQstInd (Match->Status.QstInd); // Current question index shown
Gam_PutParamAnswer (Index); // Index for this option
fprintf (Gbl.F.Out,"",
+ Gbl.Form.Id,
'A' + (char) NumOpt,
'a' + (char) NumOpt);
Frm_EndForm ();
@@ -4034,21 +4012,6 @@ void Gam_ReceiveQstAnsFromStd (void)
fprintf (Gbl.F.Out,"");
}
-/*****************************************************************************/
-/************** Get number of users who have answered a game *****************/
-/*****************************************************************************/
-
-static unsigned Gam_GetNumUsrsWhoHaveAnsweredGame (long GamCod)
- {
- /***** Get number of games with a field value from database *****/
- return
- (unsigned) DB_QueryCOUNT ("can not get number of users"
- " who have answered a game",
- "SELECT COUNT(*) FROM gam_users"
- " WHERE GamCod=%ld",
- GamCod);
- }
-
/*****************************************************************************/
/********************* Get number of courses with games **********************/
/*****************************************************************************/
diff --git a/swad_game.h b/swad_game.h
index 86c56ba04..558a2d946 100644
--- a/swad_game.h
+++ b/swad_game.h
@@ -50,7 +50,6 @@ struct Game
char Title[Gam_MAX_BYTES_TITLE + 1];
time_t TimeUTC[Gam_NUM_DATES];
unsigned NumQsts; // Number of questions in the game
- unsigned NumUsrs; // Number of distinct users who have already answered the game
struct
{
bool Visible; // Game is not hidden