Version19.17.1

This commit is contained in:
Antonio Cañas Vargas 2019-09-27 20:22:32 +02:00
parent eac6d08df5
commit befebdd2dc
6 changed files with 48 additions and 42 deletions

View File

@ -471,10 +471,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.17 (2019-09-27)"
#define Log_PLATFORM_VERSION "SWAD 19.17.1 (2019-09-27)"
#define CSS_FILE "swad19.15.css"
#define JS_FILE "swad19.15.js"
/*
Version 19.17.1: Sep 27, 2019 Remove associations between matches and groups when removing groups. (246412 lines)
Version 19.17: Sep 27, 2019 Improvements in the code that deletes a match. (246410 lines)
Version 19.16.8: Sep 27, 2019 Code refactoring. (246387 lines)
Version 19.16.7: Sep 27, 2019 Show match result for student in listing of matches. (246386 lines)

View File

@ -101,7 +101,7 @@ static void Gam_PutFormsToRemEditOneGame (const struct Game *Game,
static void Gam_PutHiddenParamOrder (void);
static void Gam_GetParamOrder (void);
static void Gam_ResetGame (struct Game *Game,long UsrCod);
static void Gam_ResetGame (struct Game *Game);
static void Gam_GetGameTxtFromDB (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
@ -756,7 +756,7 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
}
else
/* Initialize to empty game */
Gam_ResetGame (Game,-1L);
Gam_ResetGame (Game);
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
@ -796,12 +796,11 @@ void Gam_GetDataOfGameByCod (struct Game *Game)
/*************************** Initialize game to empty ************************/
/*****************************************************************************/
static void Gam_ResetGame (struct Game *Game,long UsrCod)
static void Gam_ResetGame (struct Game *Game)
{
/***** Initialize to empty game *****/
Game->GamCod = -1L;
Game->CrsCod = -1L;
// Game->UsrCod = UsrCod;
Game->UsrCod = -1L;
Game->TimeUTC[Dat_START_TIME] = (time_t) 0;
Game->TimeUTC[Dat_END_TIME ] = (time_t) 0;
@ -1071,7 +1070,7 @@ void Gam_RequestCreatOrEditGame (void)
Lay_ShowErrorAndExit ("You can not create a new game here.");
/* Initialize to empty game */
Gam_ResetGame (&Game,Gbl.Usrs.Me.UsrDat.UsrCod);
Gam_ResetGame (&Game);
}
else
{
@ -1281,37 +1280,6 @@ bool Gam_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod)
MchCod,GrpCod) != 0);
}
/*****************************************************************************/
/******************** Remove one group from all the games ********************/
/*****************************************************************************/
// TODO: Check if this function should be called when removing group
void Gam_RemoveGroup (long GrpCod)
{
/***** Remove group from all the matches *****/
DB_QueryDELETE ("can not remove group"
" from the associations between matches and groups",
"DELETE FROM mch_groups WHERE GrpCod=%ld",
GrpCod);
}
/*****************************************************************************/
/**************** Remove groups of one type from all the games ***************/
/*****************************************************************************/
// TODO: Check if this function should be called when removing group type
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"
" WHERE crs_grp.GrpTypCod=%ld"
" AND crs_grp.GrpCod=mch_groups.GrpCod",
GrpTypCod);
}
/*****************************************************************************/
/******************** Remove all the games of a course ***********************/
/*****************************************************************************/

View File

@ -97,8 +97,6 @@ void Gam_HideGame (void);
void Gam_UnhideGame (void);
void Gam_RecFormGame (void);
bool Gam_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod);
void Gam_RemoveGroup (long GrpCod);
void Gam_RemoveGroupsOfType (long GrpTypCod);
void Gam_RemoveGamesCrs (long CrsCod);
unsigned Gam_GetNumQstsGame (long GamCod);

View File

@ -4125,6 +4125,9 @@ static void Grp_RemoveGroupTypeCompletely (void)
/***** Remove the associations of attendance events to groups of this type *****/
Att_RemoveGroupsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod);
/***** Remove the associations of matches to groups of this type *****/
Mch_RemoveGroupsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod);
/***** Remove the associations of surveys to groups of this type *****/
Svy_RemoveGroupsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod);
@ -4178,13 +4181,16 @@ static void Grp_RemoveGroupCompletely (void)
/***** Remove file zones of this group *****/
Brw_RemoveGrpZones (Gbl.Hierarchy.Crs.CrsCod,GrpDat.GrpCod);
/***** Remove this group from all the assignments *****/
/***** Remove this group from all assignments *****/
Asg_RemoveGroup (GrpDat.GrpCod);
/***** Remove this group from all the attendance events *****/
/***** Remove this group from all attendance events *****/
Att_RemoveGroup (GrpDat.GrpCod);
/***** Remove this group from all the surveys *****/
/***** Remove this group from all matches *****/
Mch_RemoveGroup (GrpDat.GrpCod);
/***** Remove this group from all surveys *****/
Svy_RemoveGroup (GrpDat.GrpCod);
/***** Change this group in course timetable *****/

View File

@ -1536,6 +1536,35 @@ static void Mch_CreateGrps (long MchCod)
MchCod,Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
}
/*****************************************************************************/
/********************* Remove one group from all matches *********************/
/*****************************************************************************/
void Mch_RemoveGroup (long GrpCod)
{
/***** Remove group from all the matches *****/
DB_QueryDELETE ("can not remove group"
" from the associations between matches and groups",
"DELETE FROM mch_groups WHERE GrpCod=%ld",
GrpCod);
}
/*****************************************************************************/
/***************** Remove groups of one type from all matches ****************/
/*****************************************************************************/
void Mch_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"
" WHERE crs_grp.GrpTypCod=%ld"
" AND crs_grp.GrpCod=mch_groups.GrpCod",
GrpTypCod);
}
/*****************************************************************************/
/***************** Insert/update a game match being played *******************/
/*****************************************************************************/

View File

@ -52,6 +52,10 @@ void Mch_CreateNewMatchTch (void);
void Mch_RequestStartResumeMatchTch (void);
void Mch_GetIndexes (long MchCod,unsigned QstInd,
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]);
void Mch_RemoveGroup (long GrpCod);
void Mch_RemoveGroupsOfType (long GrpTypCod);
void Mch_PauseMatchTch (void);
void Mch_ResumeMatchTch (void);
void Mch_ToggleVisibilResultsMchQst (void);