mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-14 12:44:09 +02:00
Version18.135.3
This commit is contained in:
parent
158a55403e
commit
89e8119901
|
@ -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 */
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
59
swad_game.c
59
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,"<div class=\"%s\">%s: %u; %s: %u</div>",
|
||||
/* Number of questions */
|
||||
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: %u</div>",
|
||||
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,"</td>");
|
||||
|
||||
|
@ -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,"<td class=\"GAM_PLAY_STD_CELL\">");
|
||||
|
||||
/* 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,"<button type=\"submit\""
|
||||
" class=\"");
|
||||
" onmousedown=\"document.getElementById('%s').submit();"
|
||||
"return false;\" class=\"");
|
||||
if (StdAnsInd == (int) NumOpt) // Student's answer
|
||||
fprintf (Gbl.F.Out,"GAM_PLAY_STD_ANSWER_SELECTED ");
|
||||
fprintf (Gbl.F.Out,"GAM_PLAY_STD_BUTTON BT_%c\">"
|
||||
"%c"
|
||||
"</button>",
|
||||
Gbl.Form.Id,
|
||||
'A' + (char) NumOpt,
|
||||
'a' + (char) NumOpt);
|
||||
Frm_EndForm ();
|
||||
|
@ -4034,21 +4012,6 @@ void Gam_ReceiveQstAnsFromStd (void)
|
|||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** 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 **********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user