From 0a9f3542123989de16acf30b6711de43c1a49c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 18 Feb 2019 17:30:35 +0100 Subject: [PATCH] Version 18.49.1 --- swad_action.c | 2 +- swad_changelog.h | 3 ++- swad_group.c | 8 +++++--- swad_group.h | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/swad_action.c b/swad_action.c index 7fc72ac5..641e4165 100644 --- a/swad_action.c +++ b/swad_action.c @@ -5268,7 +5268,7 @@ void Act_AdjustCurrentAction (void) with available groups in which I must register, the only action possible is show a form to register in groups *****/ - if (Grp_GetIfAnyMandatoryGrpTypIsAvailable (-1L)) // This query may be slow + if (Grp_GetIfAvailableGrpTyp (-1L)) // This query may be slow { Gbl.Action.Act = ActReqSelGrp; Tab_SetCurrentTab (); diff --git a/swad_changelog.h b/swad_changelog.h index 287607cc..81cf9360 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -403,10 +403,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.49 (2019-02-18)" +#define Log_PLATFORM_VERSION "SWAD 18.49.1 (2019-02-18)" #define CSS_FILE "swad18.41.1.css" #define JS_FILE "swad18.32.1.js" /* + Version 18.49.1: Feb 18, 2019 Optimization in query about available mandatory group types. (237381 lines) Version 18.49: Feb 18, 2019 Optimizations adjusting actions. Fixed bug in query about available mandatory group types. (237378 lines) 1 change necessary in database: diff --git a/swad_group.c b/swad_group.c index d7463de7..5f301b16 100644 --- a/swad_group.c +++ b/swad_group.c @@ -1901,7 +1901,7 @@ static void Grp_ShowWarningToStdsToChangeGrps (void) // If I don't belong to any group if (!Grp_CheckIfIBelongToGrpsOfType (GrpTyp->GrpTypCod)) // Fast check (not necesary, but avoid slow check) // If there is any group of this type available - if (Grp_GetIfAnyMandatoryGrpTypIsAvailable (GrpTyp->GrpTypCod)) // Slow check + if (Grp_GetIfAvailableGrpTyp (GrpTyp->GrpTypCod)) // Slow check { if (GrpTyp->MandatoryEnrolment) Ale_ShowAlert (Ale_WARNING,GrpTyp->MultipleEnrolment ? Txt_You_have_to_register_compulsorily_at_least_in_one_group_of_type_X : @@ -3479,12 +3479,12 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat) } /*****************************************************************************/ -/**** Query if any mandatory group in this course is open and has vacants ****/ +/**** Get if any group in group-type/this-course is open and has vacants *****/ /*****************************************************************************/ // If GrpTypCod > 0 ==> restrict to the given group type, mandatory or not // If GrpTypCod <= 0 ==> all mandatory group types in the current course -bool Grp_GetIfAnyMandatoryGrpTypIsAvailable (long GrpTypCod) +bool Grp_GetIfAvailableGrpTyp (long GrpTypCod) { unsigned NumGrpTypes; char *SubQueryGrpTypes; @@ -3554,6 +3554,8 @@ bool Grp_GetIfAnyMandatoryGrpTypIsAvailable (long GrpTypCod) " FROM crs_grp_types,crs_grp,crs_grp_usr" " WHERE %s" // Which group types? " AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod" + " AND crs_grp.Open='Y'" // Open + " AND crs_grp.MaxStudents>0" // Admits students " AND crs_grp.GrpCod=crs_grp_usr.GrpCod" " AND crs_grp_usr.UsrCod=%ld)", // I belong diff --git a/swad_group.h b/swad_group.h index 9953fa61..b5e4adbd 100644 --- a/swad_group.h +++ b/swad_group.h @@ -186,7 +186,7 @@ bool Grp_GetIfIBelongToGrp (long GrpCod); void Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs (void); bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat); -bool Grp_GetIfAnyMandatoryGrpTypIsAvailable (long GrpTypCod); +bool Grp_GetIfAvailableGrpTyp (long GrpTypCod); void Grp_GetLstCodGrpsWithFileZonesIBelong (struct ListCodGrps *LstGrps); void Grp_GetNamesGrpsStdBelongsTo (long GrpTypCod,long UsrCod,char *GrpNames);