From 267af87d3c782cecfe55fa7d6205a78a64f75a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 5 Jan 2019 11:29:54 +0100 Subject: [PATCH] Version 18.27.8 --- swad_changelog.h | 3 ++- swad_file_browser.c | 9 +++------ swad_group.c | 45 ++++++++++++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 8dc73f0b4..1d0edbd9f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -364,10 +364,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.27.7 (2019-01-04)" +#define Log_PLATFORM_VERSION "SWAD 18.27.8 (2019-01-05)" #define CSS_FILE "swad18.22.css" #define JS_FILE "swad17.17.1.js" /* + Version 18.27.8: Jan 05, 2019 Get classroom short name from database in listing of groups. (239130 lines) Version 18.27.7: Jan 04, 2019 Show classroom in listing of groups. (239121 lines) Version 18.27.6: Jan 04, 2019 Selection of classroom in form to edit group. (239099 lines) Version 18.27.5: Jan 04, 2019 Selection of classroom in form to create group. (238964 lines) diff --git a/swad_file_browser.c b/swad_file_browser.c index b346021c6..f347f3ca0 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -12052,7 +12052,7 @@ void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod) MYSQL_ROW row; unsigned long NumRow; unsigned long NumRows; - struct GroupData GrpDat; + long GrpCod; /***** Query database *****/ if ((NumRows = Grp_GetGrpsOfType (GrpTypCod,&mysql_res))) // If there exists groups... @@ -12064,14 +12064,11 @@ void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod) row = mysql_fetch_row (mysql_res); /* Group code is in row[0] */ - if (sscanf (row[0],"%ld",&(GrpDat.GrpCod)) != 1) + if (sscanf (row[0],"%ld",&GrpCod) != 1) Lay_ShowErrorAndExit ("Wrong group code."); - /* Get name and type of the group from database */ - Grp_GetDataOfGroupByCod (&GrpDat); - /* Remove file zones of this group */ - Brw_RemoveGrpZones (Gbl.CurrentCrs.Crs.CrsCod,GrpDat.GrpCod); + Brw_RemoveGrpZones (Gbl.CurrentCrs.Crs.CrsCod,GrpCod); } /***** Free structure that stores the query result *****/ diff --git a/swad_group.c b/swad_group.c index d7add4495..90cd2916f 100644 --- a/swad_group.c +++ b/swad_group.c @@ -2490,7 +2490,7 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) Grp->GrpName); /***** Classroom *****/ - fprintf (Gbl.F.Out,"" @@ -3016,23 +3016,31 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) /* Get classroom code (row[2]) */ Grp->Classroom.ClaCod = Str_ConvertStrCodToLongCod (row[2]); + /* Get classroom short name (row[3]) */ + if (row[3]) + Str_Copy (Grp->Classroom.ShrtName,row[3], + Cla_MAX_BYTES_SHRT_NAME); + else + Grp->Classroom.ShrtName[0] = '\0'; + /* Get number of current users in group */ for (Role = Rol_TCH; Role >= Rol_STD; Role--) Grp->NumUsrs[Role] = Grp_CountNumUsrsInGrp (Role,Grp->GrpCod); - /* Get maximum number of students in group (row[3]) */ - Grp->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[3]); + /* Get maximum number of students in group (row[4]) */ + Grp->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[4]); - /* Get whether group is open ('Y') or closed ('N') (row[4]) */ - Grp->Open = (row[4][0] == 'Y'); + /* Get whether group is open ('Y') or closed ('N') (row[5]) */ + Grp->Open = (row[5][0] == 'Y'); - /* Get whether group have file zones ('Y') or not ('N') (row[5]) */ - Grp->FileZones = (row[5][0] == 'Y'); + /* Get whether group have file zones ('Y') or not ('N') (row[6]) */ + Grp->FileZones = (row[6][0] == 'Y'); } } - else // Error: groups should be found, but really they haven't be found. This never should happen. + else // Error: groups should be found, but really they haven't be found. + // This never should happen. GrpTyp->NumGrps = 0; /***** Free structure that stores the query result *****/ @@ -3111,16 +3119,19 @@ static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod) unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res) { /***** Get groups of a type from database *****/ + // Don't use INNER JOIN because there are groups without assigned classroom return DB_QuerySELECT (mysql_res,"can not get groups of a type", - "SELECT GrpCod," - "GrpName," - "ClaCod," - "MaxStudents," - "Open," - "FileZones" - " FROM crs_grp" - " WHERE GrpTypCod=%ld" - " ORDER BY GrpName", + "SELECT crs_grp.GrpCod," + "crs_grp.GrpName," + "crs_grp.ClaCod," + "classrooms.ShortName," + "crs_grp.MaxStudents," + "crs_grp.Open," + "crs_grp.FileZones" + " FROM crs_grp LEFT JOIN classrooms" + " ON crs_grp.ClaCod=classrooms.ClaCod" + " WHERE crs_grp.GrpTypCod=%ld" + " ORDER BY crs_grp.GrpName", GrpTypCod); }