Version19.5.4

This commit is contained in:
Antonio Cañas Vargas 2019-09-17 22:01:59 +02:00
parent ff1b4e0976
commit 2a3e8782c3
4 changed files with 55 additions and 34 deletions

View File

@ -469,10 +469,11 @@ Type of answer not valid in a game.
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.5.3 (2019-09-17)" #define Log_PLATFORM_VERSION "SWAD 19.5.4 (2019-09-17)"
#define CSS_FILE "swad19.3.css" #define CSS_FILE "swad19.3.css"
#define JS_FILE "swad18.130.2.js" #define JS_FILE "swad18.130.2.js"
/* /*
Version 19.5.4: Sep 17, 2019 Fixed bugs while removing games in a course. (244732 lines)
Version 19.5.3: Sep 17, 2019 Removed unused column in table of matches. Version 19.5.3: Sep 17, 2019 Removed unused column in table of matches.
Update match end time only if match is being played. (244714 lines) Update match end time only if match is being played. (244714 lines)
1 change necessary in database: 1 change necessary in database:

View File

@ -2280,6 +2280,9 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
/***** Remove all the threads and posts in forums of the course *****/ /***** Remove all the threads and posts in forums of the course *****/
For_RemoveForums (Hie_CRS,CrsCod); For_RemoveForums (Hie_CRS,CrsCod);
/***** Remove games of the course *****/
Gam_RemoveGamesCrs (CrsCod);
/***** Remove surveys of the course *****/ /***** Remove surveys of the course *****/
Svy_RemoveSurveys (Hie_CRS,CrsCod); Svy_RemoveSurveys (Hie_CRS,CrsCod);

View File

@ -976,10 +976,10 @@ void Gam_ResetGame (void)
/***** Reset all the answers in this game *****/ /***** Reset all the answers in this game *****/
DB_QueryUPDATE ("can not reset answers of a game", DB_QueryUPDATE ("can not reset answers of a game",
"UPDATE mch_answers,gam_questions" "DELETE FROM mch_answers"
" SET mch_answers.NumUsrs=0" " USING mch_matches,mch_answers"
" WHERE gam_questions.GamCod=%ld" " WHERE mch_matches.GamCod=%ld"
" AND gam_questions.QstCod=mch_answers.QstCod", " AND mch_matches.MchCod=mch_answers.MchCod",
Game.GamCod); Game.GamCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
@ -1332,43 +1332,60 @@ void Gam_RemoveGroupsOfType (long GrpTypCod)
} }
/*****************************************************************************/ /*****************************************************************************/
/************* Remove all the games of a place on the hierarchy **************/ /******************** Remove all the games of a course ***********************/
/************* (country, institution, centre, degree or course) **************/
/*****************************************************************************/ /*****************************************************************************/
void Gam_RemoveGames (long CrsCod) // TODO: Function not used????? void Gam_RemoveGamesCrs (long CrsCod)
{ {
/***** Remove all the answers in course games *****/ /***** Remove the matches of games in this course *****/
DB_QueryDELETE ("can not remove answers of games" /* Remove matches players */
" in a place on the hierarchy", DB_QueryDELETE ("can not remove match players",
"DELETE FROM mch_players"
" USING gam_games,mch_matches,mch_players"
" WHERE gam_games.CrsCod=%ld"
" AND gam_games.GamCod=mch_matches.GamCod"
" AND mch_matches.MchCod=mch_players.MchCod",
CrsCod);
/* Remove matches from list of matches being played */
DB_QueryDELETE ("can not remove matches being played",
"DELETE FROM mch_playing"
" USING gam_games,mch_matches,mch_playing"
" WHERE gam_games.CrsCod=%ld"
" AND gam_games.GamCod=mch_matches.GamCod"
" AND mch_matches.MchCod=mch_playing.MchCod",
CrsCod);
/* Remove students' answers to match */
DB_QueryDELETE ("can not remove students' answers associated to matches",
"DELETE FROM mch_answers" "DELETE FROM mch_answers"
" USING gam_games,gam_questions,mch_answers" " USING gam_games,mch_matches,mch_answers"
" WHERE gam_games.CrsCod=%ld" " WHERE gam_games.CrsCod=%ld"
" AND gam_games.GamCod=gam_questions.GamCod" " AND gam_games.GamCod=mch_matches.GamCod"
" AND gam_questions.QstCod=mch_answers.QstCod", " AND mch_matches.MchCod=mch_answers.MchCod",
CrsCod); CrsCod);
/***** Remove all the questions in course games *****/ /* Remove groups associated to the match */
DB_QueryDELETE ("can not remove questions of gam_games" DB_QueryDELETE ("can not remove the groups associated to matches",
" in a place on the hierarchy",
"DELETE FROM gam_questions"
" USING gam_games,gam_questions"
" WHERE gam_games.CrsCod=%ld"
" AND gam_games.GamCod=gam_questions.GamCod",
CrsCod);
/***** Remove groups *****/
DB_QueryDELETE ("can not remove all the groups"
" associated to games of a course",
"DELETE FROM mch_groups" "DELETE FROM mch_groups"
" USING gam_games,mch_groups" " USING gam_games,mch_matches,mch_answers"
" WHERE gam_games.CrsCod=%ld" " WHERE gam_games.CrsCod=%ld"
" AND gam_games.GamCod=mch_groups.GamCod", " AND gam_games.GamCod=mch_matches.GamCod"
CrsCod); " AND mch_matches.MchCod=mch_groups.MchCod",
CrsCod);
/***** Remove course games *****/ /* Remove the matches themselves */
DB_QueryDELETE ("can not remove all the games in a place on the hierarchy", DB_QueryDELETE ("can not remove matches",
"DELETE FROM gam_games WHERE CrsCod=%ld", "DELETE FROM mch_matches"
" USING gam_games,mch_matches"
" WHERE gam_games.CrsCod=%ld"
" AND gam_games.GamCod=mch_matches.GamCod",
CrsCod);
/***** Remove the games *****/
DB_QueryDELETE ("can not remove games",
"DELETE FROM gam_games"
" WHERE CrsCod=%ld",
CrsCod); CrsCod);
} }

View File

@ -105,7 +105,7 @@ void Gam_RecFormGame (void);
bool Gam_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod); bool Gam_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod);
void Gam_RemoveGroup (long GrpCod); void Gam_RemoveGroup (long GrpCod);
void Gam_RemoveGroupsOfType (long GrpTypCod); void Gam_RemoveGroupsOfType (long GrpTypCod);
void Gam_RemoveGames (long CrsCod); void Gam_RemoveGamesCrs (long CrsCod);
unsigned Gam_GetNumQstsGame (long GamCod); unsigned Gam_GetNumQstsGame (long GamCod);