mirror of https://github.com/acanas/swad-core.git
Version 20.51.29: Mar 20, 2021 Attendance groups database table renamed.
This commit is contained in:
parent
a56dab304f
commit
8e521f25ad
|
@ -108,9 +108,9 @@ CREATE TABLE IF NOT EXISTS att_events (
|
||||||
UNIQUE INDEX(AttCod),
|
UNIQUE INDEX(AttCod),
|
||||||
INDEX(CrsCod,Hidden));
|
INDEX(CrsCod,Hidden));
|
||||||
--
|
--
|
||||||
-- Table att_grp: stores groups associated to control attendance
|
-- Table att_groups: stores groups associated to control attendance
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS att_grp (
|
CREATE TABLE IF NOT EXISTS att_groups (
|
||||||
AttCod INT NOT NULL,
|
AttCod INT NOT NULL,
|
||||||
GrpCod INT NOT NULL,
|
GrpCod INT NOT NULL,
|
||||||
UNIQUE INDEX(AttCod,GrpCod));
|
UNIQUE INDEX(AttCod,GrpCod));
|
||||||
|
|
35
swad_API.c
35
swad_API.c
|
@ -2712,7 +2712,9 @@ static void API_GetListGrpsInAttendanceEventFromDB (struct soap *soap,
|
||||||
NumGrps =
|
NumGrps =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get groups"
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get groups"
|
||||||
" of an attendance event",
|
" of an attendance event",
|
||||||
"SELECT GrpCod FROM att_grp WHERE AttCod=%ld",
|
"SELECT GrpCod"
|
||||||
|
" FROM att_groups"
|
||||||
|
" WHERE AttCod=%ld",
|
||||||
AttCod);
|
AttCod);
|
||||||
if (NumGrps == 0)
|
if (NumGrps == 0)
|
||||||
*ListGroups = NULL;
|
*ListGroups = NULL;
|
||||||
|
@ -3006,21 +3008,28 @@ int swad__getAttendanceUsers (struct soap *soap,
|
||||||
"Requester must be a teacher");
|
"Requester must be a teacher");
|
||||||
|
|
||||||
/***** Query list of attendance users *****/
|
/***** Query list of attendance users *****/
|
||||||
if (Grp_CheckIfAssociatedToGrps ("att_grp","AttCod",Event.AttCod))
|
if (Grp_CheckIfAssociatedToGrps ("att_groups","AttCod",Event.AttCod))
|
||||||
// Event for one or more groups
|
// Event for one or more groups
|
||||||
// Subquery: list of users in groups of this attendance event...
|
// Subquery: list of users in groups of this attendance event...
|
||||||
// ...who have no entry in attendance list of users
|
// ...who have no entry in attendance list of users
|
||||||
sprintf (SubQuery,"SELECT DISTINCT crs_grp_usr.UsrCod AS UsrCod,'N' AS Present"
|
sprintf (SubQuery,"SELECT DISTINCT crs_grp_usr.UsrCod AS UsrCod,"
|
||||||
" FROM att_grp,crs_grp,crs_grp_types,crs_usr,crs_grp_usr"
|
"'N' AS Present"
|
||||||
" WHERE att_grp.AttCod=%ld"
|
" FROM att_groups,"
|
||||||
" AND att_grp.GrpCod=crs_grp.GrpCod"
|
"crs_grp,"
|
||||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
"crs_grp_types,"
|
||||||
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
"crs_usr,"
|
||||||
" AND crs_usr.Role=%u"
|
"crs_grp_usr"
|
||||||
" AND crs_usr.UsrCod=crs_grp_usr.UsrCod"
|
" WHERE att_groups.AttCod=%ld"
|
||||||
" AND crs_grp_usr.GrpCod=att_grp.GrpCod"
|
" AND att_groups.GrpCod=crs_grp.GrpCod"
|
||||||
" AND crs_grp_usr.UsrCod NOT IN"
|
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||||
" (SELECT UsrCod FROM att_usr WHERE AttCod=%ld)",
|
" AND crs_grp_types.CrsCod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.Role=%u"
|
||||||
|
" AND crs_usr.UsrCod=crs_grp_usr.UsrCod"
|
||||||
|
" AND crs_grp_usr.GrpCod=att_groups.GrpCod"
|
||||||
|
" AND crs_grp_usr.UsrCod NOT IN"
|
||||||
|
" (SELECT UsrCod"
|
||||||
|
" FROM att_usr"
|
||||||
|
" WHERE AttCod=%ld)",
|
||||||
Event.AttCod,
|
Event.AttCod,
|
||||||
(unsigned) Rol_STD,
|
(unsigned) Rol_STD,
|
||||||
Event.AttCod);
|
Event.AttCod);
|
||||||
|
|
|
@ -679,12 +679,19 @@ static void Att_GetListAttEvents (struct Att_Events *Events,
|
||||||
if (Gbl.Crs.Grps.WhichGrps == Grp_MY_GROUPS)
|
if (Gbl.Crs.Grps.WhichGrps == Grp_MY_GROUPS)
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get attendance events",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get attendance events",
|
||||||
"SELECT AttCod"
|
"SELECT AttCod"
|
||||||
" FROM att_events"
|
" FROM att_events"
|
||||||
" WHERE CrsCod=%ld%s"
|
" WHERE CrsCod=%ld"
|
||||||
" AND (AttCod NOT IN (SELECT AttCod FROM att_grp) OR"
|
"%s"
|
||||||
" AttCod IN (SELECT att_grp.AttCod FROM att_grp,crs_grp_usr"
|
" AND (AttCod NOT IN"
|
||||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
" (SELECT AttCod"
|
||||||
" AND att_grp.GrpCod=crs_grp_usr.GrpCod))"
|
" FROM att_groups)"
|
||||||
|
" OR"
|
||||||
|
" AttCod IN"
|
||||||
|
" (SELECT att_groups.AttCod"
|
||||||
|
" FROM crs_grp_usr,"
|
||||||
|
"att_groups"
|
||||||
|
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||||
|
" AND att_groups.GrpCod=crs_grp_usr.GrpCod))"
|
||||||
" ORDER BY %s",
|
" ORDER BY %s",
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
HiddenSubQuery[Gbl.Usrs.Me.Role.Logged],
|
HiddenSubQuery[Gbl.Usrs.Me.Role.Logged],
|
||||||
|
@ -1265,8 +1272,8 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Grp_CheckIfAssociatedToGrps ("att_grp","AttCod",AttCod) ? "" :
|
Grp_CheckIfAssociatedToGrps ("att_groups","AttCod",AttCod) ? "" :
|
||||||
" checked=\"checked\"");
|
" checked=\"checked\"");
|
||||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -1461,7 +1468,8 @@ static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod)
|
||||||
/***** Remove groups of the attendance event *****/
|
/***** Remove groups of the attendance event *****/
|
||||||
DB_QueryDELETE ("can not remove the groups"
|
DB_QueryDELETE ("can not remove the groups"
|
||||||
" associated to an attendance event",
|
" associated to an attendance event",
|
||||||
"DELETE FROM att_grp WHERE AttCod=%ld",
|
"DELETE FROM att_groups"
|
||||||
|
" WHERE AttCod=%ld",
|
||||||
AttCod);
|
AttCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1474,7 +1482,8 @@ void Att_RemoveGroup (long GrpCod)
|
||||||
/***** Remove group from all the attendance events *****/
|
/***** Remove group from all the attendance events *****/
|
||||||
DB_QueryDELETE ("can not remove group from the associations"
|
DB_QueryDELETE ("can not remove group from the associations"
|
||||||
" between attendance events and groups",
|
" between attendance events and groups",
|
||||||
"DELETE FROM att_grp WHERE GrpCod=%ld",
|
"DELETE FROM att_groups"
|
||||||
|
" WHERE GrpCod=%ld",
|
||||||
GrpCod);
|
GrpCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1487,9 +1496,11 @@ void Att_RemoveGroupsOfType (long GrpTypCod)
|
||||||
/***** Remove group from all the attendance events *****/
|
/***** Remove group from all the attendance events *****/
|
||||||
DB_QueryDELETE ("can not remove groups of a type from the associations"
|
DB_QueryDELETE ("can not remove groups of a type from the associations"
|
||||||
" between attendance events and groups",
|
" between attendance events and groups",
|
||||||
"DELETE FROM att_grp USING crs_grp,att_grp"
|
"DELETE FROM att_groups"
|
||||||
|
" USING crs_grp,"
|
||||||
|
"att_groups"
|
||||||
" WHERE crs_grp.GrpTypCod=%ld"
|
" WHERE crs_grp.GrpTypCod=%ld"
|
||||||
" AND crs_grp.GrpCod=att_grp.GrpCod",
|
" AND crs_grp.GrpCod=att_groups.GrpCod",
|
||||||
GrpTypCod);
|
GrpTypCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1507,7 +1518,7 @@ static void Att_CreateGrps (long AttCod)
|
||||||
NumGrpSel++)
|
NumGrpSel++)
|
||||||
/* Create group */
|
/* Create group */
|
||||||
DB_QueryINSERT ("can not associate a group to an attendance event",
|
DB_QueryINSERT ("can not associate a group to an attendance event",
|
||||||
"INSERT INTO att_grp"
|
"INSERT INTO att_groups"
|
||||||
" (AttCod,GrpCod)"
|
" (AttCod,GrpCod)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld)",
|
" (%ld,%ld)",
|
||||||
|
@ -1535,13 +1546,13 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct Att_Event *Ev
|
||||||
"SELECT crs_grp_types.GrpTypName,"
|
"SELECT crs_grp_types.GrpTypName,"
|
||||||
"crs_grp.GrpName,"
|
"crs_grp.GrpName,"
|
||||||
"roo_rooms.ShortName"
|
"roo_rooms.ShortName"
|
||||||
" FROM (att_grp,"
|
" FROM (att_groups,"
|
||||||
"crs_grp,"
|
"crs_grp,"
|
||||||
"crs_grp_types)"
|
"crs_grp_types)"
|
||||||
" LEFT JOIN roo_rooms"
|
" LEFT JOIN roo_rooms"
|
||||||
" ON crs_grp.RooCod=roo_rooms.RooCod"
|
" ON crs_grp.RooCod=roo_rooms.RooCod"
|
||||||
" WHERE att_grp.AttCod=%ld"
|
" WHERE att_groups.AttCod=%ld"
|
||||||
" AND att_grp.GrpCod=crs_grp.GrpCod"
|
" AND att_groups.GrpCod=crs_grp.GrpCod"
|
||||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
||||||
" ORDER BY crs_grp_types.GrpTypName,"
|
" ORDER BY crs_grp_types.GrpTypName,"
|
||||||
"crs_grp.GrpName",
|
"crs_grp.GrpName",
|
||||||
|
@ -1659,14 +1670,17 @@ void Att_RemoveCrsAttEvents (long CrsCod)
|
||||||
/***** Remove groups *****/
|
/***** Remove groups *****/
|
||||||
DB_QueryDELETE ("can not remove all the groups associated"
|
DB_QueryDELETE ("can not remove all the groups associated"
|
||||||
" to attendance events of a course",
|
" to attendance events of a course",
|
||||||
"DELETE FROM att_grp USING att_events,att_grp"
|
"DELETE FROM att_groups"
|
||||||
|
" USING att_events,"
|
||||||
|
"att_groups"
|
||||||
" WHERE att_events.CrsCod=%ld"
|
" WHERE att_events.CrsCod=%ld"
|
||||||
" AND att_events.AttCod=att_grp.AttCod",
|
" AND att_events.AttCod=att_groups.AttCod",
|
||||||
CrsCod);
|
CrsCod);
|
||||||
|
|
||||||
/***** Remove attendance events *****/
|
/***** Remove attendance events *****/
|
||||||
DB_QueryDELETE ("can not remove all the attendance events of a course",
|
DB_QueryDELETE ("can not remove all the attendance events of a course",
|
||||||
"DELETE FROM att_events WHERE CrsCod=%ld",
|
"DELETE FROM att_events"
|
||||||
|
" WHERE CrsCod=%ld",
|
||||||
CrsCod);
|
CrsCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2253,8 +2267,9 @@ static void Att_PutParamsCodGrps (long AttCod)
|
||||||
/***** Get groups associated to an attendance event from database *****/
|
/***** Get groups associated to an attendance event from database *****/
|
||||||
if (Gbl.Crs.Grps.NumGrps)
|
if (Gbl.Crs.Grps.NumGrps)
|
||||||
NumGrps = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups of an attendance event",
|
NumGrps = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups of an attendance event",
|
||||||
"SELECT GrpCod FROM att_grp"
|
"SELECT GrpCod" // row[0]
|
||||||
" WHERE att_grp.AttCod=%ld",
|
" FROM att_groups"
|
||||||
|
" WHERE att_groups.AttCod=%ld",
|
||||||
AttCod);
|
AttCod);
|
||||||
else
|
else
|
||||||
NumGrps = 0;
|
NumGrps = 0;
|
||||||
|
@ -3044,8 +3059,9 @@ static void Att_GetListSelectedAttCods (struct Att_Events *Events)
|
||||||
/***** Get groups associated to an attendance event from database *****/
|
/***** Get groups associated to an attendance event from database *****/
|
||||||
NumGrpsInThisEvent = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups"
|
NumGrpsInThisEvent = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups"
|
||||||
" of an attendance event",
|
" of an attendance event",
|
||||||
"SELECT GrpCod FROM att_grp"
|
"SELECT GrpCod" // row[0]
|
||||||
" WHERE att_grp.AttCod=%ld",
|
" FROM att_groups"
|
||||||
|
" WHERE att_groups.AttCod=%ld",
|
||||||
Events->Lst[NumAttEvent].AttCod);
|
Events->Lst[NumAttEvent].AttCod);
|
||||||
if (NumGrpsInThisEvent) // This event is associated to groups
|
if (NumGrpsInThisEvent) // This event is associated to groups
|
||||||
/* Get groups associated to this event */
|
/* Get groups associated to this event */
|
||||||
|
|
|
@ -600,14 +600,18 @@ TODO: Salvador Romero Cort
|
||||||
|
|
||||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.51.28 (2021-03-20)"
|
#define Log_PLATFORM_VERSION "SWAD 20.51.29 (2021-03-20)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.6.2.js"
|
#define JS_FILE "swad20.6.2.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
Version 20.51.28: Mar 20, 2021 Assignment groups database table renamed. (308219 lines)
|
Version 20.51.29: Mar 20, 2021 Attendance groups database table renamed. (308259 lines)
|
||||||
|
1 change necessary in database:
|
||||||
|
RENAME TABLE att_grp TO att_groups;
|
||||||
|
|
||||||
|
Version 20.51.28: Mar 20, 2021 Assignment groups database table renamed. (308234 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
RENAME TABLE asg_grp TO asg_groups;
|
RENAME TABLE asg_grp TO asg_groups;
|
||||||
|
|
||||||
|
|
|
@ -294,9 +294,9 @@ mysql> DESCRIBE att_events;
|
||||||
"UNIQUE INDEX(AttCod),"
|
"UNIQUE INDEX(AttCod),"
|
||||||
"INDEX(CrsCod,Hidden))");
|
"INDEX(CrsCod,Hidden))");
|
||||||
|
|
||||||
/***** Table att_grp *****/
|
/***** Table att_groups *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE att_grp;
|
mysql> DESCRIBE att_groups;
|
||||||
+--------+---------+------+-----+---------+-------+
|
+--------+---------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------+---------+------+-----+---------+-------+
|
+--------+---------+------+-----+---------+-------+
|
||||||
|
@ -305,7 +305,7 @@ mysql> DESCRIBE att_grp;
|
||||||
+--------+---------+------+-----+---------+-------+
|
+--------+---------+------+-----+---------+-------+
|
||||||
2 rows in set (0.00 sec)
|
2 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS att_grp ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS att_groups ("
|
||||||
"AttCod INT NOT NULL,"
|
"AttCod INT NOT NULL,"
|
||||||
"GrpCod INT NOT NULL,"
|
"GrpCod INT NOT NULL,"
|
||||||
"UNIQUE INDEX(AttCod,GrpCod))");
|
"UNIQUE INDEX(AttCod,GrpCod))");
|
||||||
|
|
|
@ -1692,8 +1692,8 @@ void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,
|
||||||
const char *Field;
|
const char *Field;
|
||||||
} AssociationsToGrps[Grp_NUM_ASSOCIATIONS_TO_GROUPS] =
|
} AssociationsToGrps[Grp_NUM_ASSOCIATIONS_TO_GROUPS] =
|
||||||
{
|
{
|
||||||
[Grp_ASSIGNMENT] = {"asg_groups" ,"AsgCod"},
|
[Grp_ASSIGNMENT] = {"asg_groups","AsgCod"},
|
||||||
[Grp_ATT_EVENT ] = {"att_grp" ,"AttCod"},
|
[Grp_ATT_EVENT ] = {"att_groups","AttCod"},
|
||||||
[Grp_SURVEY ] = {"svy_grp" ,"SvyCod"},
|
[Grp_SURVEY ] = {"svy_grp" ,"SvyCod"},
|
||||||
[Grp_EXA_EVENT ] = {"exa_groups","SesCod"},
|
[Grp_EXA_EVENT ] = {"exa_groups","SesCod"},
|
||||||
[Grp_MATCH ] = {"mch_groups","MchCod"},
|
[Grp_MATCH ] = {"mch_groups","MchCod"},
|
||||||
|
|
Loading…
Reference in New Issue