Version 20.51.45: Mar 25, 2021 Project users database table renamed.

This commit is contained in:
acanas 2021-03-25 23:52:15 +01:00
parent b6d84b9e96
commit 60aa976efc
6 changed files with 67 additions and 52 deletions

View File

@ -1306,9 +1306,9 @@ CREATE TABLE IF NOT EXISTS sta_degrees (
TimeToComputeAvgPhoto INT NOT NULL DEFAULT -1,
UNIQUE INDEX(DegCod,Sex));
--
-- Table sta_notif: stores statistics about notifications: number of notified events and number of e-mails sent
-- Table sta_notifications: stores statistics about notifications: number of notified events and number of e-mails sent
--
CREATE TABLE IF NOT EXISTS sta_notif (
CREATE TABLE IF NOT EXISTS sta_notifications (
DegCod INT NOT NULL,
CrsCod INT NOT NULL,
NotifyEvent TINYINT NOT NULL,

View File

@ -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.
*/
#define Log_PLATFORM_VERSION "SWAD 20.51.43 (2021-03-24)"
#define Log_PLATFORM_VERSION "SWAD 20.51.45 (2021-03-25)"
#define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.6.2.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 20.51.44: Mar 25, 2021 Project users database table renamed. (308751 lines)
Version 20.51.45: Mar 25, 2021 Project users database table renamed. (308767 lines)
1 change necessary in database:
RENAME TABLE sta_notif TO sta_notifications;
Version 20.51.44: Mar 25, 2021 Project users database table renamed. (308756 lines)
1 change necessary in database:
RENAME TABLE prj_usr TO prj_users;

View File

@ -2760,9 +2760,9 @@ mysql> DESCRIBE sta_degrees;
"TimeToComputeAvgPhoto INT NOT NULL DEFAULT -1,"
"UNIQUE INDEX(DegCod,Sex))");
/***** Table sta_notif *****/
/***** Table sta_notifications *****/
/*
mysql> DESCRIBE sta_notif;
mysql> DESCRIBE sta_notifications;
+-------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------+------+-----+---------+-------+
@ -2774,7 +2774,7 @@ mysql> DESCRIBE sta_notif;
+-------------+------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS sta_notif ("
DB_CreateTable ("CREATE TABLE IF NOT EXISTS sta_notifications ("
"DegCod INT NOT NULL,"
"CrsCod INT NOT NULL,"
"NotifyEvent TINYINT NOT NULL,"

View File

@ -4621,72 +4621,78 @@ static void Fig_GetAndShowNumUsrsPerNotifyEvent (void)
case Hie_Lvl_SYS:
DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email",
"SELECT SUM(NumEvents),SUM(NumMails)"
" FROM sta_notif"
"SELECT SUM(NumEvents)," // row[0]
"SUM(NumMails)" // row[1]
" FROM sta_notifications"
" WHERE NotifyEvent=%u",
(unsigned) NotifyEvent);
break;
case Hie_Lvl_CTY:
DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email",
"SELECT SUM(sta_notif.NumEvents),"
"SUM(sta_notif.NumMails)"
" FROM ins_instits,"
"ctr_centers,"
"deg_degrees,"
"sta_notif"
"SELECT SUM(sta_notifications.NumEvents)," // row[0]
"SUM(sta_notifications.NumMails)" // row[1]
" FROM ins_instits,"
"ctr_centers,"
"deg_degrees,"
"sta_notifications"
" WHERE ins_instits.CtyCod=%ld"
" AND ins_instits.InsCod=ctr_centers.InsCod"
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
" AND deg_degrees.DegCod=sta_notif.DegCod"
" AND sta_notif.NotifyEvent=%u",
Gbl.Hierarchy.Cty.CtyCod,(unsigned) NotifyEvent);
" AND ins_instits.InsCod=ctr_centers.InsCod"
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
" AND deg_degrees.DegCod=sta_notifications.DegCod"
" AND sta_notifications.NotifyEvent=%u",
Gbl.Hierarchy.Cty.CtyCod,
(unsigned) NotifyEvent);
break;
case Hie_Lvl_INS:
DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email",
"SELECT SUM(sta_notif.NumEvents),"
"SUM(sta_notif.NumMails)"
" FROM ctr_centers,"
"deg_degrees,"
"sta_notif"
"SELECT SUM(sta_notifications.NumEvents)," // row[0]
"SUM(sta_notifications.NumMails)" // row[1]
" FROM ctr_centers,"
"deg_degrees,"
"sta_notifications"
" WHERE ctr_centers.InsCod=%ld"
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
" AND deg_degrees.DegCod=sta_notif.DegCod"
" AND sta_notif.NotifyEvent=%u",
Gbl.Hierarchy.Ins.InsCod,(unsigned) NotifyEvent);
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
" AND deg_degrees.DegCod=sta_notifications.DegCod"
" AND sta_notifications.NotifyEvent=%u",
Gbl.Hierarchy.Ins.InsCod,
(unsigned) NotifyEvent);
break;
case Hie_Lvl_CTR:
DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email",
"SELECT SUM(sta_notif.NumEvents),"
"SUM(sta_notif.NumMails)"
" FROM deg_degrees,"
"sta_notif"
"SELECT SUM(sta_notifications.NumEvents)," // row[0]
"SUM(sta_notifications.NumMails)" // row[1]
" FROM deg_degrees,"
"sta_notifications"
" WHERE deg_degrees.CtrCod=%ld"
" AND deg_degrees.DegCod=sta_notif.DegCod"
" AND sta_notif.NotifyEvent=%u",
Gbl.Hierarchy.Ctr.CtrCod,(unsigned) NotifyEvent);
" AND deg_degrees.DegCod=sta_notifications.DegCod"
" AND sta_notifications.NotifyEvent=%u",
Gbl.Hierarchy.Ctr.CtrCod,
(unsigned) NotifyEvent);
break;
case Hie_Lvl_DEG:
DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email",
"SELECT SUM(NumEvents),"
"SUM(NumMails)"
" FROM sta_notif"
"SELECT SUM(NumEvents)," // row[0]
"SUM(NumMails)" // row[1]
" FROM sta_notifications"
" WHERE DegCod=%ld"
" AND NotifyEvent=%u",
Gbl.Hierarchy.Deg.DegCod,(unsigned) NotifyEvent);
" AND NotifyEvent=%u",
Gbl.Hierarchy.Deg.DegCod,
(unsigned) NotifyEvent);
break;
case Hie_Lvl_CRS:
DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email",
"SELECT SUM(NumEvents),"
"SUM(NumMails)"
" FROM sta_notif"
"SELECT SUM(NumEvents)," // row[0]
"SUM(NumMails)" // row[1]
" FROM sta_notifications"
" WHERE CrsCod=%ld"
" AND NotifyEvent=%u",
Gbl.Hierarchy.Crs.CrsCod,(unsigned) NotifyEvent);
" AND NotifyEvent=%u",
Gbl.Hierarchy.Crs.CrsCod,
(unsigned) NotifyEvent);
break;
default:
Lay_WrongScopeExit ();

View File

@ -1907,10 +1907,15 @@ static void Ntf_GetNumNotifSent (long DegCod,long CrsCod,
/***** Get number of notifications sent by email from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of notifications"
" sent by email",
"SELECT NumEvents,NumMails FROM sta_notif"
" WHERE DegCod=%ld AND CrsCod=%ld"
" AND NotifyEvent=%u",
DegCod,CrsCod,(unsigned) NotifyEvent);
"SELECT NumEvents," // row[0]
"NumMails" // row[1]
" FROM sta_notifications"
" WHERE DegCod=%ld"
" AND CrsCod=%ld"
" AND NotifyEvent=%u",
DegCod,
CrsCod,
(unsigned) NotifyEvent);
/***** Get number of rows *****/
if (NumRows)
@ -1944,7 +1949,7 @@ static void Ntf_UpdateNumNotifSent (long DegCod,long CrsCod,
/***** Update number of users notified *****/
DB_QueryREPLACE ("can not update the number of sent notifications",
"REPLACE INTO sta_notif"
"REPLACE INTO sta_notifications"
" (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)"
" VALUES"
" (%ld,%ld,%u,%u,%u)",

View File

@ -50,7 +50,7 @@
#define Ntf_NUM_NOTIFY_EVENTS (1 + 20)
// If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones
// in database tables notif, sta_notif and usr_data
// in database tables ntf_notifications, sta_notifications and usr_data
typedef enum // TODO: Change numbers (also in database)!!!!!!!!!!!!!!
{
Ntf_EVENT_UNKNOWN = 0,