mirror of
https://github.com/acanas/swad-core.git
synced 2024-05-29 13:03:31 +02:00
Version 20.51.30: Mar 20, 2021 Survey groups database table renamed.
This commit is contained in:
parent
8e521f25ad
commit
64a4aa6ce9
|
@ -1332,9 +1332,9 @@ CREATE TABLE IF NOT EXISTS svy_answers (
|
||||||
Answer TEXT NOT NULL,
|
Answer TEXT NOT NULL,
|
||||||
UNIQUE INDEX(QstCod,AnsInd));
|
UNIQUE INDEX(QstCod,AnsInd));
|
||||||
--
|
--
|
||||||
-- Table svy_grp: stores the groups associated to each survey
|
-- Table svy_groups: stores the groups associated to each survey
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS svy_grp (
|
CREATE TABLE IF NOT EXISTS svy_groups (
|
||||||
SvyCod INT NOT NULL,
|
SvyCod INT NOT NULL,
|
||||||
GrpCod INT NOT NULL,
|
GrpCod INT NOT NULL,
|
||||||
UNIQUE INDEX(SvyCod,GrpCod));
|
UNIQUE INDEX(SvyCod,GrpCod));
|
||||||
|
|
|
@ -600,13 +600,17 @@ 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.29 (2021-03-20)"
|
#define Log_PLATFORM_VERSION "SWAD 20.51.30 (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.30: Mar 20, 2021 Survey groups database table renamed. (308287 lines)
|
||||||
|
1 change necessary in database:
|
||||||
|
RENAME TABLE svy_grp TO svy_groups;
|
||||||
|
|
||||||
Version 20.51.29: Mar 20, 2021 Attendance groups database table renamed. (308259 lines)
|
Version 20.51.29: Mar 20, 2021 Attendance groups database table renamed. (308259 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
RENAME TABLE att_grp TO att_groups;
|
RENAME TABLE att_grp TO att_groups;
|
||||||
|
|
|
@ -2779,9 +2779,9 @@ mysql> DESCRIBE svy_answers;
|
||||||
"Answer TEXT NOT NULL," // Cns_MAX_BYTES_TEXT
|
"Answer TEXT NOT NULL," // Cns_MAX_BYTES_TEXT
|
||||||
"UNIQUE INDEX(QstCod,AnsInd))");
|
"UNIQUE INDEX(QstCod,AnsInd))");
|
||||||
|
|
||||||
/***** Table svy_grp *****/
|
/***** Table svy_groups *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE svy_grp;
|
mysql> DESCRIBE svy_groups;
|
||||||
+--------+---------+------+-----+---------+-------+
|
+--------+---------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------+---------+------+-----+---------+-------+
|
+--------+---------+------+-----+---------+-------+
|
||||||
|
@ -2790,7 +2790,7 @@ mysql> DESCRIBE svy_grp;
|
||||||
+--------+---------+------+-----+---------+-------+
|
+--------+---------+------+-----+---------+-------+
|
||||||
2 rows in set (0.01 sec)
|
2 rows in set (0.01 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS svy_grp ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS svy_groups ("
|
||||||
"SvyCod INT NOT NULL,"
|
"SvyCod INT NOT NULL,"
|
||||||
"GrpCod INT NOT NULL,"
|
"GrpCod INT NOT NULL,"
|
||||||
"UNIQUE INDEX(SvyCod,GrpCod))");
|
"UNIQUE INDEX(SvyCod,GrpCod))");
|
||||||
|
|
|
@ -1694,7 +1694,7 @@ void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,
|
||||||
{
|
{
|
||||||
[Grp_ASSIGNMENT] = {"asg_groups","AsgCod"},
|
[Grp_ASSIGNMENT] = {"asg_groups","AsgCod"},
|
||||||
[Grp_ATT_EVENT ] = {"att_groups","AttCod"},
|
[Grp_ATT_EVENT ] = {"att_groups","AttCod"},
|
||||||
[Grp_SURVEY ] = {"svy_grp" ,"SvyCod"},
|
[Grp_SURVEY ] = {"svy_groups","SvyCod"},
|
||||||
[Grp_EXA_EVENT ] = {"exa_groups","SesCod"},
|
[Grp_EXA_EVENT ] = {"exa_groups","SesCod"},
|
||||||
[Grp_MATCH ] = {"mch_groups","MchCod"},
|
[Grp_MATCH ] = {"mch_groups","MchCod"},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1402,25 +1402,31 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get users"
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get users"
|
||||||
" to be notified",
|
" to be notified",
|
||||||
"(SELECT crs_usr.UsrCod"
|
"(SELECT crs_usr.UsrCod"
|
||||||
" FROM svy_surveys,crs_usr"
|
" FROM svy_surveys,"
|
||||||
" WHERE svy_surveys.SvyCod=%ld"
|
"crs_usr"
|
||||||
" AND svy_surveys.SvyCod NOT IN"
|
" WHERE svy_surveys.SvyCod=%ld"
|
||||||
" (SELECT SvyCod FROM svy_grp WHERE SvyCod=%ld)"
|
" AND svy_surveys.SvyCod NOT IN"
|
||||||
" AND svy_surveys.Scope='%s'"
|
" (SELECT SvyCod"
|
||||||
" AND svy_surveys.Cod=crs_usr.CrsCod"
|
" FROM svy_groups"
|
||||||
" AND crs_usr.UsrCod<>%ld"
|
" WHERE SvyCod=%ld)"
|
||||||
" AND (svy_surveys.Roles&(1<<crs_usr.Role))<>0)"
|
" AND svy_surveys.Scope='%s'"
|
||||||
|
" AND svy_surveys.Cod=crs_usr.CrsCod"
|
||||||
|
" AND crs_usr.UsrCod<>%ld"
|
||||||
|
" AND (svy_surveys.Roles&(1<<crs_usr.Role))<>0)"
|
||||||
" UNION "
|
" UNION "
|
||||||
"(SELECT DISTINCT crs_grp_usr.UsrCod"
|
"(SELECT DISTINCT crs_grp_usr.UsrCod"
|
||||||
" FROM svy_grp,crs_grp_usr,svy_surveys,crs_usr"
|
" FROM svy_groups,"
|
||||||
" WHERE svy_grp.SvyCod=%ld"
|
"crs_grp_usr,"
|
||||||
" AND svy_grp.GrpCod=crs_grp_usr.GrpCod"
|
"svy_surveys,"
|
||||||
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
"crs_usr"
|
||||||
" AND crs_grp_usr.UsrCod<>%ld"
|
" WHERE svy_groups.SvyCod=%ld"
|
||||||
" AND svy_grp.SvyCod=svy_surveys.SvyCod"
|
" AND svy_groups.GrpCod=crs_grp_usr.GrpCod"
|
||||||
" AND svy_surveys.Scope='%s'"
|
" AND crs_grp_usr.UsrCod=crs_usr.UsrCod"
|
||||||
" AND svy_surveys.Cod=crs_usr.CrsCod"
|
" AND crs_grp_usr.UsrCod<>%ld"
|
||||||
" AND (svy_surveys.Roles&(1<<crs_usr.Role))<>0)",
|
" AND svy_groups.SvyCod=svy_surveys.SvyCod"
|
||||||
|
" AND svy_surveys.Scope='%s'"
|
||||||
|
" AND svy_surveys.Cod=crs_usr.CrsCod"
|
||||||
|
" AND (svy_surveys.Roles&(1<<crs_usr.Role))<>0)",
|
||||||
Cod,
|
Cod,
|
||||||
Cod,
|
Cod,
|
||||||
Sco_GetDBStrFromScope (Hie_Lvl_CRS),
|
Sco_GetDBStrFromScope (Hie_Lvl_CRS),
|
||||||
|
|
|
@ -988,16 +988,18 @@ static void Svy_GetListSurveys (struct Svy_Surveys *Surveys)
|
||||||
if (Gbl.Crs.Grps.WhichGrps == Grp_MY_GROUPS)
|
if (Gbl.Crs.Grps.WhichGrps == Grp_MY_GROUPS)
|
||||||
{
|
{
|
||||||
if (asprintf (&SubQuery[Hie_Lvl_CRS],"%s("
|
if (asprintf (&SubQuery[Hie_Lvl_CRS],"%s("
|
||||||
"Scope='%s' AND Cod=%ld%s"
|
"Scope='%s'"
|
||||||
|
" AND Cod=%ld%s"
|
||||||
" AND "
|
" AND "
|
||||||
"(SvyCod NOT IN"
|
"(SvyCod NOT IN"
|
||||||
" (SELECT SvyCod FROM svy_grp)"
|
" (SELECT SvyCod"
|
||||||
|
" FROM svy_groups)"
|
||||||
" OR"
|
" OR"
|
||||||
" SvyCod IN"
|
" SvyCod IN"
|
||||||
" (SELECT svy_grp.SvyCod"
|
" (SELECT svy_groups.SvyCod"
|
||||||
" FROM svy_grp,crs_grp_usr"
|
" FROM svy_groups,crs_grp_usr"
|
||||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||||
" AND svy_grp.GrpCod=crs_grp_usr.GrpCod))"
|
" AND svy_groups.GrpCod=crs_grp_usr.GrpCod))"
|
||||||
")",
|
")",
|
||||||
SubQueryFilled ? " OR " :
|
SubQueryFilled ? " OR " :
|
||||||
"",
|
"",
|
||||||
|
@ -2151,8 +2153,8 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
|
||||||
HTM_LABEL_Begin (NULL);
|
HTM_LABEL_Begin (NULL);
|
||||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
"id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
|
"id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||||
Grp_CheckIfAssociatedToGrps ("svy_grp","SvyCod",SvyCod) ? "" :
|
Grp_CheckIfAssociatedToGrps ("svy_groups","SvyCod",SvyCod) ? "" :
|
||||||
" 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 ();
|
||||||
|
@ -2420,7 +2422,8 @@ static void Svy_RemoveAllTheGrpsAssociatedToAndSurvey (long SvyCod)
|
||||||
{
|
{
|
||||||
/***** Remove groups of the survey *****/
|
/***** Remove groups of the survey *****/
|
||||||
DB_QueryDELETE ("can not remove the groups associated to a survey",
|
DB_QueryDELETE ("can not remove the groups associated to a survey",
|
||||||
"DELETE FROM svy_grp WHERE SvyCod=%ld",
|
"DELETE FROM svy_groups"
|
||||||
|
" WHERE SvyCod=%ld",
|
||||||
SvyCod);
|
SvyCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2433,7 +2436,8 @@ void Svy_RemoveGroup (long GrpCod)
|
||||||
/***** Remove group from all the surveys *****/
|
/***** Remove group from all the surveys *****/
|
||||||
DB_QueryDELETE ("can not remove group from the associations"
|
DB_QueryDELETE ("can not remove group from the associations"
|
||||||
" between surveys and groups",
|
" between surveys and groups",
|
||||||
"DELETE FROM svy_grp WHERE GrpCod=%ld",
|
"DELETE FROM svy_groups"
|
||||||
|
" WHERE GrpCod=%ld",
|
||||||
GrpCod);
|
GrpCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2446,9 +2450,11 @@ void Svy_RemoveGroupsOfType (long GrpTypCod)
|
||||||
/***** Remove group from all the surveys *****/
|
/***** Remove group from all the surveys *****/
|
||||||
DB_QueryDELETE ("can not remove groups of a type"
|
DB_QueryDELETE ("can not remove groups of a type"
|
||||||
" from the associations between surveys and groups",
|
" from the associations between surveys and groups",
|
||||||
"DELETE FROM svy_grp USING crs_grp,svy_grp"
|
"DELETE FROM svy_groups"
|
||||||
|
" USING crs_grp,"
|
||||||
|
"svy_groups"
|
||||||
" WHERE crs_grp.GrpTypCod=%ld"
|
" WHERE crs_grp.GrpTypCod=%ld"
|
||||||
" AND crs_grp.GrpCod=svy_grp.GrpCod",
|
" AND crs_grp.GrpCod=svy_groups.GrpCod",
|
||||||
GrpTypCod);
|
GrpTypCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2466,7 +2472,7 @@ static void Svy_CreateGrps (long SvyCod)
|
||||||
NumGrpSel++)
|
NumGrpSel++)
|
||||||
/* Create group */
|
/* Create group */
|
||||||
DB_QueryINSERT ("can not associate a group to a survey",
|
DB_QueryINSERT ("can not associate a group to a survey",
|
||||||
"INSERT INTO svy_grp"
|
"INSERT INTO svy_groups"
|
||||||
" (SvyCod,GrpCod)"
|
" (SvyCod,GrpCod)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld)",
|
" (%ld,%ld)",
|
||||||
|
@ -2490,13 +2496,14 @@ static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Svy_Survey *Svy)
|
||||||
|
|
||||||
/***** Get groups associated to a survey from database *****/
|
/***** Get groups associated to a survey from database *****/
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get groups of a survey",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get groups of a survey",
|
||||||
"SELECT crs_grp_types.GrpTypName,crs_grp.GrpName"
|
"SELECT crs_grp_types.GrpTypName,"
|
||||||
" FROM svy_grp,crs_grp,crs_grp_types"
|
"crs_grp.GrpName"
|
||||||
" WHERE svy_grp.SvyCod=%ld"
|
" FROM svy_groups,crs_grp,crs_grp_types"
|
||||||
" AND svy_grp.GrpCod=crs_grp.GrpCod"
|
" WHERE svy_groups.SvyCod=%ld"
|
||||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
" AND svy_groups.GrpCod=crs_grp.GrpCod"
|
||||||
|
" 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",
|
||||||
Svy->SvyCod);
|
Svy->SvyCod);
|
||||||
|
|
||||||
/***** Write heading *****/
|
/***** Write heading *****/
|
||||||
|
@ -2576,10 +2583,12 @@ void Svy_RemoveSurveys (Hie_Lvl_Level_t Scope,long Cod)
|
||||||
/***** Remove groups *****/
|
/***** Remove groups *****/
|
||||||
DB_QueryDELETE ("can not remove all the groups"
|
DB_QueryDELETE ("can not remove all the groups"
|
||||||
" associated to surveys of a course",
|
" associated to surveys of a course",
|
||||||
"DELETE FROM svy_grp"
|
"DELETE FROM svy_groups"
|
||||||
" USING svy_surveys,svy_grp"
|
" USING svy_surveys,"
|
||||||
" WHERE svy_surveys.Scope='%s' AND svy_surveys.Cod=%ld"
|
"svy_groups"
|
||||||
" AND svy_surveys.SvyCod=svy_grp.SvyCod",
|
" WHERE svy_surveys.Scope='%s'"
|
||||||
|
" AND svy_surveys.Cod=%ld"
|
||||||
|
" AND svy_surveys.SvyCod=svy_groups.SvyCod",
|
||||||
Sco_GetDBStrFromScope (Scope),Cod);
|
Sco_GetDBStrFromScope (Scope),Cod);
|
||||||
|
|
||||||
/***** Remove course surveys *****/
|
/***** Remove course surveys *****/
|
||||||
|
@ -2598,12 +2607,19 @@ static bool Svy_CheckIfICanDoThisSurveyBasedOnGrps (long SvyCod)
|
||||||
{
|
{
|
||||||
/***** Get if I can do a survey from database *****/
|
/***** Get if I can do a survey from database *****/
|
||||||
return (DB_QueryCOUNT ("can not check if I can do a survey",
|
return (DB_QueryCOUNT ("can not check if I can do a survey",
|
||||||
"SELECT COUNT(*) FROM svy_surveys"
|
"SELECT COUNT(*)"
|
||||||
|
" FROM svy_surveys"
|
||||||
" WHERE SvyCod=%ld"
|
" WHERE SvyCod=%ld"
|
||||||
" AND (SvyCod NOT IN (SELECT SvyCod FROM svy_grp) OR"
|
" AND"
|
||||||
" SvyCod IN (SELECT svy_grp.SvyCod FROM svy_grp,crs_grp_usr"
|
" (SvyCod NOT IN"
|
||||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
" (SELECT SvyCod FROM svy_groups)"
|
||||||
" AND svy_grp.GrpCod=crs_grp_usr.GrpCod))",
|
" OR"
|
||||||
|
" SvyCod IN"
|
||||||
|
" (SELECT svy_groups.SvyCod"
|
||||||
|
" FROM crs_grp_usr,"
|
||||||
|
"svy_groups"
|
||||||
|
" WHERE crs_grp_usr.UsrCod=%ld"
|
||||||
|
" AND svy_groups.GrpCod=crs_grp_usr.GrpCod))",
|
||||||
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod) != 0);
|
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user