diff --git a/swad_changelog.h b/swad_changelog.h index 3477c077..e704fb2d 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.28 (2019-01-07)" +#define Log_PLATFORM_VERSION "SWAD 18.28.1 (2019-01-07)" #define CSS_FILE "swad18.22.css" #define JS_FILE "swad17.17.1.js" /* + Version 18.28.1: Jan 07, 2019 Fixed bug in timetable related to groups. (239213 lines) Version 18.28: Jan 07, 2019 Changes in edition of timetable related to classrooms. (239208 lines) 9 changes necessary in database: ALTER TABLE timetable_crs CHANGE COLUMN GroupName GroupName VARCHAR(2047) NOT NULL DEFAULT ''; diff --git a/swad_group.c b/swad_group.c index 2e0b143b..b3e8d138 100644 --- a/swad_group.c +++ b/swad_group.c @@ -3021,10 +3021,10 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) Grp->Classroom.ClaCod = Str_ConvertStrCodToLongCod (row[2]); /* Get classroom short name (row[3]) */ - if (row[3]) + if (row[3]) // May be NULL because of LEFT JOIN Str_Copy (Grp->Classroom.ShrtName,row[3], Cla_MAX_BYTES_SHRT_NAME); - else + else // NULL Grp->Classroom.ShrtName[0] = '\0'; /* Get number of current users in group */ @@ -3234,16 +3234,16 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat) { /***** Get data of a group from database *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a group", - "SELECT crs_grp.GrpTypCod," - "crs_grp_types.CrsCod," - "crs_grp_types.GrpTypName," - "crs_grp_types.Multiple," - "crs_grp.GrpName," - "crs_grp.ClaCod," - "classrooms.ShortName," - "crs_grp.MaxStudents," - "crs_grp.Open," - "crs_grp.FileZones" + "SELECT crs_grp.GrpTypCod," // row[0] + "crs_grp_types.CrsCod," // row[1] + "crs_grp_types.GrpTypName," // row[2] + "crs_grp_types.Multiple," // row[3] + "crs_grp.GrpName," // row[4] + "crs_grp.ClaCod," // row[5] + "classrooms.ShortName," // row[6] + "crs_grp.MaxStudents," // row[7] + "crs_grp.Open," // row[8] + "crs_grp.FileZones" // row[9] " FROM (crs_grp,crs_grp_types)" " LEFT JOIN classrooms" " ON crs_grp.ClaCod=classrooms.ClaCod" @@ -3279,8 +3279,11 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat) GrpDat->Classroom.ClaCod = Str_ConvertStrCodToLongCod (row[5]); /* Get the name of the classroom (row[6]) */ - Str_Copy (GrpDat->Classroom.ShrtName,row[6], - Grp_MAX_BYTES_GROUP_NAME); + if (row[6]) // May be NULL because of LEFT JOIN + Str_Copy (GrpDat->Classroom.ShrtName,row[6], + Cla_MAX_BYTES_SHRT_NAME); + else // NULL + GrpDat->Classroom.ShrtName[0] = '\0'; /* Get maximum number of students (row[7]) */ GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[7]); diff --git a/swad_timetable.c b/swad_timetable.c index 0e44adbd..592617e3 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -1520,10 +1520,10 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co /***** Group *****/ if (Gbl.TimeTable.View == TT_CRS_VIEW && - GrpCod > 0) + GrpCod > 0) { fprintf (Gbl.F.Out,"
%s" - "
%s", + "
%s", GrpDat.GrpTypName,GrpDat.GrpName); if (GrpDat.Classroom.ClaCod > 0) fprintf (Gbl.F.Out,"
(%s)", @@ -1531,8 +1531,9 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co } /***** Info *****/ - if (Info[0]) - fprintf (Gbl.F.Out,"
%s",Info); + if (Info) + if (Info[0]) + fprintf (Gbl.F.Out,"
%s",Info); /***** End cell *****/ fprintf (Gbl.F.Out,""); @@ -1670,7 +1671,9 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co CellStr, Txt_Info, CellStr, - TT_MAX_CHARS_INFO,Info, + TT_MAX_CHARS_INFO, + Info ? Info : + "", Gbl.Form.Id); } else // TimeTableView == TT_TUT_EDIT diff --git a/swad_timetable.h b/swad_timetable.h index 13c1349a..039a1691 100644 --- a/swad_timetable.h +++ b/swad_timetable.h @@ -36,9 +36,6 @@ #define TT_MAX_CHARS_INFO (128 - 1) // 127 #define TT_MAX_BYTES_INFO ((TT_MAX_CHARS_INFO + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 -// #define TT_MAX_CHARS_PLACE (32 - 1) // 31 -// #define TT_MAX_BYTES_PLACE ((TT_MAX_CHARS_INFO + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511 - typedef enum { TT_CRS_VIEW,