diff --git a/swad_changelog.h b/swad_changelog.h index 93fd56434..a6658f83d 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -464,10 +464,11 @@ can not remove the groups associated to matches of a game Type of answer not valid in a game. */ -#define Log_PLATFORM_VERSION "SWAD 19.4 (2019-09-17)" +#define Log_PLATFORM_VERSION "SWAD 19.4.1 (2019-09-17)" #define CSS_FILE "swad19.3.css" #define JS_FILE "swad18.130.2.js" /* + Version 19.4.1: Sep 17, 2019 Fixed bug when removing a question in a game. (244650 lines) Version 19.4: Sep 17, 2019 Changes in games ans matches tables. (244644 lines) 8 changes necessary in database: RENAME TABLE gam_answers TO mch_answers; diff --git a/swad_game.c b/swad_game.c index 643dd99d9..c5da99eaa 100644 --- a/swad_game.c +++ b/swad_game.c @@ -904,7 +904,8 @@ void Gam_RemoveGame (void) /***** Remove all the matches in this game *****/ /* Remove groups in matches of the game */ DB_QueryDELETE ("can not remove the groups associated to matches of a game", - "DELETE FROM mch_groups USING mch_groups,mch_matches" + "DELETE FROM mch_groups" + " USING mch_matches,mch_groups" " WHERE mch_matches.GrpCod=%ld" " AND mch_matches.MchCod=mch_groups.MchCod", Game.GamCod); @@ -1331,7 +1332,8 @@ void Gam_RemoveGroupsOfType (long GrpTypCod) /***** Remove group from all the matches *****/ DB_QueryDELETE ("can not remove groups of a type" " from the associations between matches and groups", - "DELETE FROM mch_groups USING crs_grp,mch_groups" + "DELETE FROM mch_groups" + " USING crs_grp,mch_groups" " WHERE crs_grp.GrpTypCod=%ld" " AND crs_grp.GrpCod=mch_groups.GrpCod", GrpTypCod); @@ -1462,10 +1464,13 @@ unsigned Gam_GetQstIndFromStr (const char *UnsignedStr) static void Gam_RemAnswersOfAQuestion (long GamCod,unsigned QstInd) { - /***** Remove answers *****/ + /***** Remove answers from all matches of this game *****/ DB_QueryDELETE ("can not remove the answers of a question", "DELETE FROM mch_answers" - " WHERE GamCod=%ld AND QstInd=%u", + " USING mch_matches,mch_answers" + " WHERE mch_matches.GamCod=%ld" // From all matches of this game... + " AND mch_matches.MchCod=mch_answers.MchCod" + " AND mch_answers.QstInd=%u", // ...remove only answers to this question GamCod,QstInd); }