mirror of https://github.com/acanas/swad-core.git
Version18.139
This commit is contained in:
parent
525d93dfd4
commit
881deaeb67
|
@ -12872,3 +12872,10 @@ SELECT UNIX_TIMESTAMP(MIN(StartTime)),UNIX_TIMESTAMP(MAX(EndTime)) FROM gam_matc
|
|||
|
||||
|
||||
SELECT MchCod,GamCod,UsrCod,UNIX_TIMESTAMP(StartTime),UNIX_TIMESTAMP(EndTime),Title,QstInd,QstCod,UNIX_TIMESTAMP(QstStartTime),ShowingAnswers,Finished FROM gam_matches WHERE GamCod=7 ORDER BY MchCod;
|
||||
|
||||
|
||||
REPLACE gam_time (MchCod,QstInd,ElapsedTime) VALUES (61,1,ADDTIME(ElapsedTime,SEC_TO_TIME(1)));
|
||||
|
||||
INSERT INTO gam_time (MchCod,QstInd) VALUES (61,1,SEC_TO_TIME(1)) ON DUPLICATE KEY UPDATE ElapsedTime=ADDTIME(ElapsedTime,SEC_TO_TIME(1));
|
||||
|
||||
|
||||
|
|
|
@ -667,6 +667,14 @@ CREATE TABLE IF NOT EXISTS gam_questions (
|
|||
INDEX(GamCod),
|
||||
INDEX(QstCod));
|
||||
--
|
||||
-- Table gam_time: stores the elapsed time in every question in every match played
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS gam_time (
|
||||
MchCod INT NOT NULL,
|
||||
QstInd INT NOT NULL,
|
||||
ElapsedTime TIME NOT NULL DEFAULT 0,
|
||||
UNIQUE INDEX(MchCod,QstInd));
|
||||
--
|
||||
-- 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 (
|
||||
|
|
|
@ -460,12 +460,15 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.138.6 (2019-08-02)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.139 (2019-08-03)"
|
||||
#define CSS_FILE "swad18.138.css"
|
||||
#define JS_FILE "swad18.130.2.js"
|
||||
/*
|
||||
Version 18.138.7: Aug 01, 2019 Time of current match and current match question are stored in database. (? lines)
|
||||
Version 18.138.6: Aug 02, 2019 Matches finished can be played again from list of matches. (? lines)
|
||||
Version 18.139: Aug 03, 2019 Time of current match and current match question are stored in database. (244150 lines)
|
||||
1 change necessary in database:
|
||||
CREATE TABLE IF NOT EXISTS gam_time (MchCod INT NOT NULL,QstInd INT NOT NULL,ElapsedTime TIME NOT NULL DEFAULT 0,UNIQUE INDEX(MchCod,QstInd));
|
||||
|
||||
Version 18.138.6: Aug 02, 2019 Matches finished can be played again from list of matches. (244102 lines)
|
||||
Version 18.138.5: Aug 01, 2019 Finished column in matches replaced by a special value in question index. (244108 lines)
|
||||
1 change necessary in database:
|
||||
ALTER TABLE gam_matches DROP COLUMN Finished;
|
||||
|
|
|
@ -1452,6 +1452,24 @@ mysql> DESCRIBE gam_questions;
|
|||
"INDEX(GamCod),"
|
||||
"INDEX(QstCod))");
|
||||
|
||||
/***** Table gam_time *****/
|
||||
/*
|
||||
mysql> DESCRIBE gam_time;
|
||||
+-------------+---------+------+-----+----------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-------------+---------+------+-----+----------+-------+
|
||||
| MchCod | int(11) | NO | PRI | NULL | |
|
||||
| QstInd | int(11) | NO | PRI | NULL | |
|
||||
| ElapsedTime | time | NO | | 00:00:00 | |
|
||||
+-------------+---------+------+-----+----------+-------+
|
||||
3 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS gam_time ("
|
||||
"MchCod INT NOT NULL,"
|
||||
"QstInd INT NOT NULL,"
|
||||
"ElapsedTime TIME NOT NULL DEFAULT 0,"
|
||||
"UNIQUE INDEX(MchCod,QstInd))");
|
||||
|
||||
/***** Table hidden_params *****/
|
||||
/*
|
||||
mysql> DESCRIBE hidden_params;
|
||||
|
|
24
swad_game.c
24
swad_game.c
|
@ -187,6 +187,7 @@ static void Gam_PutFormNewMatch (struct Game *Game);
|
|||
|
||||
static long Gam_CreateMatch (long GamCod,char Title[Gam_MAX_BYTES_TITLE + 1]);
|
||||
static void Gam_UpdateMatchStatusInDB (struct Match *Match);
|
||||
static void Gam_UpdateElapsedTimeInQuestion (struct Match *Match);
|
||||
|
||||
static void Gam_SetMatchStatusToPrevQuestion (struct Match *Match);
|
||||
static void Gam_SetMatchStatusToNextQuestion (struct Match *Match);
|
||||
|
@ -3342,6 +3343,26 @@ static void Gam_UpdateMatchStatusInDB (struct Match *Match)
|
|||
Gam_SetMatchAsNotBeingPlayed (Match->MchCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/** Update elapsed time in current question (by a teacher) **/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Gam_UpdateElapsedTimeInQuestion (struct Match *Match)
|
||||
{
|
||||
/***** Update elapsed time in current question in database *****/
|
||||
if (Match->Status.BeingPlayed &&
|
||||
Match->Status.QstInd > 0 &&
|
||||
Match->Status.QstInd < Gam_AFTER_LAST_QUESTION)
|
||||
DB_QueryINSERT ("can not update elapsed time in question",
|
||||
"INSERT INTO gam_time (MchCod,QstInd,ElapsedTime)"
|
||||
" VALUES (%ld,%u,SEC_TO_TIME(%u))"
|
||||
" ON DUPLICATE KEY"
|
||||
" UPDATE ElapsedTime=ADDTIME(ElapsedTime,SEC_TO_TIME(%u))",
|
||||
Match->MchCod,Match->Status.QstInd,
|
||||
Cfg_SECONDS_TO_REFRESH_GAME,
|
||||
Cfg_SECONDS_TO_REFRESH_GAME);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/** Show current match status (current question, answers...) (by a teacher) **/
|
||||
/*****************************************************************************/
|
||||
|
@ -4168,6 +4189,9 @@ void Gam_RefreshMatchTch (void)
|
|||
/***** Update match status in database *****/
|
||||
Gam_UpdateMatchStatusInDB (&Match);
|
||||
|
||||
/***** Update elapsed time in this question *****/
|
||||
Gam_UpdateElapsedTimeInQuestion (&Match);
|
||||
|
||||
/***** Show current match status *****/
|
||||
Gam_ShowMatchStatusForTch (&Match);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue