Version 18.27.4

This commit is contained in:
Antonio Cañas Vargas 2019-01-04 11:59:31 +01:00
parent 434a846f84
commit 4870c7e134
5 changed files with 56 additions and 32 deletions

View File

@ -280,11 +280,13 @@ CREATE TABLE IF NOT EXISTS crs_grp (
GrpCod INT NOT NULL AUTO_INCREMENT, GrpCod INT NOT NULL AUTO_INCREMENT,
GrpTypCod INT NOT NULL, GrpTypCod INT NOT NULL,
GrpName VARCHAR(2047) NOT NULL, GrpName VARCHAR(2047) NOT NULL,
ClaCod INT NOT NULL DEFAULT -1,
MaxStudents INT NOT NULL, MaxStudents INT NOT NULL,
Open ENUM('N','Y') NOT NULL DEFAULT 'N', Open ENUM('N','Y') NOT NULL DEFAULT 'N',
FileZones ENUM('N','Y') NOT NULL DEFAULT 'N', FileZones ENUM('N','Y') NOT NULL DEFAULT 'N',
UNIQUE INDEX(GrpCod), UNIQUE INDEX(GrpCod),
INDEX(GrpTypCod)); INDEX(GrpTypCod),
INDEX(ClaCod));
-- --
-- Table crs_grp_types: stores the types of groups in courses -- Table crs_grp_types: stores the types of groups in courses
-- --

View File

@ -364,10 +364,14 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 18.27.3 (2019-01-03)" #define Log_PLATFORM_VERSION "SWAD 18.27.4 (2019-01-04)"
#define CSS_FILE "swad18.22.css" #define CSS_FILE "swad18.22.css"
#define JS_FILE "swad17.17.1.js" #define JS_FILE "swad17.17.1.js"
/* /*
Version 18.27.4: Jan 04, 2019 New field in groups table to select a classroom. (238881 lines)
1 change necessary in database:
ALTER TABLE crs_grp ADD COLUMN ClaCod INT NOT NULL DEFAULT -1 AFTER GrpName,ADD INDEX (ClaCod);
Version 18.27.3: Jan 03, 2019 Rows in colors in listing of classrooms. Version 18.27.3: Jan 03, 2019 Rows in colors in listing of classrooms.
Fixed bugs in classrooms. (238860 lines) Fixed bugs in classrooms. (238860 lines)
Version 18.27.2: Jan 03, 2019 Short name and full name in listing of classrooms. (238847 lines) Version 18.27.2: Jan 03, 2019 Short name and full name in listing of classrooms. (238847 lines)

View File

@ -659,21 +659,24 @@ mysql> DESCRIBE crs_grp;
| GrpCod | int(11) | NO | PRI | NULL | auto_increment | | GrpCod | int(11) | NO | PRI | NULL | auto_increment |
| GrpTypCod | int(11) | NO | MUL | NULL | | | GrpTypCod | int(11) | NO | MUL | NULL | |
| GrpName | varchar(2047) | NO | | NULL | | | GrpName | varchar(2047) | NO | | NULL | |
| ClaCod | int(11) | NO | MUL | -1 | |
| MaxStudents | int(11) | NO | | NULL | | | MaxStudents | int(11) | NO | | NULL | |
| Open | enum('N','Y') | NO | | N | | | Open | enum('N','Y') | NO | | N | |
| FileZones | enum('N','Y') | NO | | N | | | FileZones | enum('N','Y') | NO | | N | |
+-------------+---------------+------+-----+---------+----------------+ +-------------+---------------+------+-----+---------+----------------+
6 rows in set (0,00 sec) 7 rows in set (0.00 sec)
*/ */
DB_CreateTable ("CREATE TABLE IF NOT EXISTS crs_grp (" DB_CreateTable ("CREATE TABLE IF NOT EXISTS crs_grp ("
"GrpCod INT NOT NULL AUTO_INCREMENT," "GrpCod INT NOT NULL AUTO_INCREMENT,"
"GrpTypCod INT NOT NULL," "GrpTypCod INT NOT NULL,"
"GrpName VARCHAR(2047) NOT NULL," // Grp_MAX_BYTES_GROUP_NAME "GrpName VARCHAR(2047) NOT NULL," // Grp_MAX_BYTES_GROUP_NAME
"MaxStudents INT NOT NULL," "MaxStudents INT NOT NULL,"
"ClaCod INT NOT NULL DEFAULT -1,"
"Open ENUM('N','Y') NOT NULL DEFAULT 'N'," "Open ENUM('N','Y') NOT NULL DEFAULT 'N',"
"FileZones ENUM('N','Y') NOT NULL DEFAULT 'N'," "FileZones ENUM('N','Y') NOT NULL DEFAULT 'N',"
"UNIQUE INDEX(GrpCod)," "UNIQUE INDEX(GrpCod),"
"INDEX(GrpTypCod))"); "INDEX(GrpTypCod),"
"INDEX(ClaCod))");
/***** Table crs_grp_types *****/ /***** Table crs_grp_types *****/
/* /*

View File

@ -2890,8 +2890,8 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
Str_Copy (Grp->GrpName,row[1], Str_Copy (Grp->GrpName,row[1],
Grp_MAX_BYTES_GROUP_NAME); Grp_MAX_BYTES_GROUP_NAME);
/* Get max number of students of group (row[2]) */ /* Get classroom code (row[2]) */
Grp->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[2]); Grp->ClaCod = Str_ConvertStrCodToLongCod (row[2]);
/* Get number of current users in group */ /* Get number of current users in group */
for (Role = Rol_TCH; for (Role = Rol_TCH;
@ -2899,11 +2899,14 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
Role--) Role--)
Grp->NumUsrs[Role] = Grp_CountNumUsrsInGrp (Role,Grp->GrpCod); Grp->NumUsrs[Role] = Grp_CountNumUsrsInGrp (Role,Grp->GrpCod);
/* Get whether group is open ('Y') or closed ('N') (row[3]) */ /* Get maximum number of students in group (row[3]) */
Grp->Open = (row[3][0] == 'Y'); Grp->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[3]);
/* Get whether group have file zones ('Y') or not ('N') (row[4]) */ /* Get whether group is open ('Y') or closed ('N') (row[4]) */
Grp->FileZones = (row[4][0] == 'Y'); Grp->Open = (row[4][0] == 'Y');
/* Get whether group have file zones ('Y') or not ('N') (row[5]) */
Grp->FileZones = (row[5][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.
@ -2979,14 +2982,19 @@ static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod)
} }
/*****************************************************************************/ /*****************************************************************************/
/***************** Get current groups of a type in this course ***************/ /******************** Get groups of a type in this course ********************/
/*****************************************************************************/ /*****************************************************************************/
unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res) unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res)
{ {
/***** Get groups of a type from database *****/ /***** Get groups of a type from database *****/
return DB_QuerySELECT (mysql_res,"can not get groups of a type", return DB_QuerySELECT (mysql_res,"can not get groups of a type",
"SELECT GrpCod,GrpName,MaxStudents,Open,FileZones" "SELECT GrpCod,"
"GrpName,"
"MaxStudents,"
"ClaCod,"
"Open,"
"FileZones"
" FROM crs_grp" " FROM crs_grp"
" WHERE GrpTypCod=%ld" " WHERE GrpTypCod=%ld"
" ORDER BY GrpName", " ORDER BY GrpName",
@ -3007,10 +3015,10 @@ static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp)
/***** Get data of a type of group from database *****/ /***** Get data of a type of group from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get type of group", NumRows = DB_QuerySELECT (&mysql_res,"can not get type of group",
"SELECT GrpTypName," "SELECT GrpTypName,"
"Mandatory," "Mandatory,"
"Multiple," "Multiple,"
"MustBeOpened," "MustBeOpened,"
"UNIX_TIMESTAMP(OpenTime)" "UNIX_TIMESTAMP(OpenTime)"
" FROM crs_grp_types" " FROM crs_grp_types"
" WHERE CrsCod=%ld AND GrpTypCod=%ld", " WHERE CrsCod=%ld AND GrpTypCod=%ld",
Gbl.CurrentCrs.Crs.CrsCod,GrpTyp->GrpTypCod); Gbl.CurrentCrs.Crs.CrsCod,GrpTyp->GrpTypCod);
@ -3071,12 +3079,13 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
unsigned long NumRows; unsigned long NumRows;
/***** Reset values *****/ /***** Reset values *****/
GrpDat->GrpTypCod = -1L; GrpDat->GrpTypCod = -1L;
GrpDat->CrsCod = -1L; GrpDat->CrsCod = -1L;
GrpDat->GrpTypName[0] = '\0'; GrpDat->GrpTypName[0] = '\0';
GrpDat->GrpName[0] = '\0'; GrpDat->GrpName[0] = '\0';
GrpDat->MaxStudents = 0; GrpDat->ClaCod = -1L;
GrpDat->Vacant = 0; GrpDat->MaxStudents = 0;
GrpDat->Vacant = 0;
GrpDat->Open = false; GrpDat->Open = false;
GrpDat->FileZones = false; GrpDat->FileZones = false;
GrpDat->MultipleEnrolment = false; GrpDat->MultipleEnrolment = false;
@ -3090,6 +3099,7 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
"crs_grp_types.GrpTypName," "crs_grp_types.GrpTypName,"
"crs_grp_types.Multiple," "crs_grp_types.Multiple,"
"crs_grp.GrpName," "crs_grp.GrpName,"
"crs_grp.ClaCod,"
"crs_grp.MaxStudents," "crs_grp.MaxStudents,"
"crs_grp.Open," "crs_grp.Open,"
"crs_grp.FileZones" "crs_grp.FileZones"
@ -3122,14 +3132,17 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
Str_Copy (GrpDat->GrpName,row[4], Str_Copy (GrpDat->GrpName,row[4],
Grp_MAX_BYTES_GROUP_NAME); Grp_MAX_BYTES_GROUP_NAME);
/* Get maximum number of students (row[5]) */ /* Get the code of the course (row[5]) */
GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[5]); GrpDat->ClaCod = Str_ConvertStrCodToLongCod (row[5]);
/* Get whether group is open or closed (row[6]) */ /* Get maximum number of students (row[6]) */
GrpDat->Open = (row[6][0] == 'Y'); GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[6]);
/* Get whether group has file zones (row[7]) */ /* Get whether group is open or closed (row[7]) */
GrpDat->FileZones = (row[7][0] == 'Y'); GrpDat->Open = (row[7][0] == 'Y');
/* Get whether group has file zones (row[8]) */
GrpDat->FileZones = (row[8][0] == 'Y');
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/

View File

@ -57,11 +57,12 @@ typedef enum
// Related with groups // Related with groups
struct GroupData struct GroupData
{ {
long GrpCod; long GrpCod; // Group code
long GrpTypCod; long GrpTypCod; // Group type code
long CrsCod; long CrsCod; // Course code
char GrpTypName[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1]; char GrpTypName[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1];
char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1];
long ClaCod; // Classroom code
unsigned MaxStudents; unsigned MaxStudents;
int Vacant; int Vacant;
bool Open; // Group is open? bool Open; // Group is open?
@ -73,8 +74,9 @@ struct Group
{ {
long GrpCod; // Code of group long GrpCod; // Code of group
char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; // Name of group char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; // Name of group
long ClaCod; // Classroom code
unsigned NumUsrs[Rol_NUM_ROLES]; // Number of users in the group unsigned NumUsrs[Rol_NUM_ROLES]; // Number of users in the group
unsigned MaxStudents; unsigned MaxStudents; // Maximum number of students in the group
bool Open; // Group is open? bool Open; // Group is open?
bool FileZones; // Group has file zones? bool FileZones; // Group has file zones?
bool ShowFileZone; // Show file zone of this group? bool ShowFileZone; // Show file zone of this group?