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, TimeToComputeAvgPhoto INT NOT NULL DEFAULT -1,
UNIQUE INDEX(DegCod,Sex)); 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, DegCod INT NOT NULL,
CrsCod INT NOT NULL, CrsCod INT NOT NULL,
NotifyEvent TINYINT 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. 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 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.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: 1 change necessary in database:
RENAME TABLE prj_usr TO prj_users; RENAME TABLE prj_usr TO prj_users;

View File

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

View File

@ -4621,72 +4621,78 @@ static void Fig_GetAndShowNumUsrsPerNotifyEvent (void)
case Hie_Lvl_SYS: case Hie_Lvl_SYS:
DB_QuerySELECT (&mysql_res,"can not get the number" DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email", " of notifications by email",
"SELECT SUM(NumEvents),SUM(NumMails)" "SELECT SUM(NumEvents)," // row[0]
" FROM sta_notif" "SUM(NumMails)" // row[1]
" FROM sta_notifications"
" WHERE NotifyEvent=%u", " WHERE NotifyEvent=%u",
(unsigned) NotifyEvent); (unsigned) NotifyEvent);
break; break;
case Hie_Lvl_CTY: case Hie_Lvl_CTY:
DB_QuerySELECT (&mysql_res,"can not get the number" DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email", " of notifications by email",
"SELECT SUM(sta_notif.NumEvents)," "SELECT SUM(sta_notifications.NumEvents)," // row[0]
"SUM(sta_notif.NumMails)" "SUM(sta_notifications.NumMails)" // row[1]
" FROM ins_instits," " FROM ins_instits,"
"ctr_centers," "ctr_centers,"
"deg_degrees," "deg_degrees,"
"sta_notif" "sta_notifications"
" WHERE ins_instits.CtyCod=%ld" " WHERE ins_instits.CtyCod=%ld"
" AND ins_instits.InsCod=ctr_centers.InsCod" " AND ins_instits.InsCod=ctr_centers.InsCod"
" AND ctr_centers.CtrCod=deg_degrees.CtrCod" " AND ctr_centers.CtrCod=deg_degrees.CtrCod"
" AND deg_degrees.DegCod=sta_notif.DegCod" " AND deg_degrees.DegCod=sta_notifications.DegCod"
" AND sta_notif.NotifyEvent=%u", " AND sta_notifications.NotifyEvent=%u",
Gbl.Hierarchy.Cty.CtyCod,(unsigned) NotifyEvent); Gbl.Hierarchy.Cty.CtyCod,
(unsigned) NotifyEvent);
break; break;
case Hie_Lvl_INS: case Hie_Lvl_INS:
DB_QuerySELECT (&mysql_res,"can not get the number" DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email", " of notifications by email",
"SELECT SUM(sta_notif.NumEvents)," "SELECT SUM(sta_notifications.NumEvents)," // row[0]
"SUM(sta_notif.NumMails)" "SUM(sta_notifications.NumMails)" // row[1]
" FROM ctr_centers," " FROM ctr_centers,"
"deg_degrees," "deg_degrees,"
"sta_notif" "sta_notifications"
" WHERE ctr_centers.InsCod=%ld" " WHERE ctr_centers.InsCod=%ld"
" AND ctr_centers.CtrCod=deg_degrees.CtrCod" " AND ctr_centers.CtrCod=deg_degrees.CtrCod"
" AND deg_degrees.DegCod=sta_notif.DegCod" " AND deg_degrees.DegCod=sta_notifications.DegCod"
" AND sta_notif.NotifyEvent=%u", " AND sta_notifications.NotifyEvent=%u",
Gbl.Hierarchy.Ins.InsCod,(unsigned) NotifyEvent); Gbl.Hierarchy.Ins.InsCod,
(unsigned) NotifyEvent);
break; break;
case Hie_Lvl_CTR: case Hie_Lvl_CTR:
DB_QuerySELECT (&mysql_res,"can not get the number" DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email", " of notifications by email",
"SELECT SUM(sta_notif.NumEvents)," "SELECT SUM(sta_notifications.NumEvents)," // row[0]
"SUM(sta_notif.NumMails)" "SUM(sta_notifications.NumMails)" // row[1]
" FROM deg_degrees," " FROM deg_degrees,"
"sta_notif" "sta_notifications"
" WHERE deg_degrees.CtrCod=%ld" " WHERE deg_degrees.CtrCod=%ld"
" AND deg_degrees.DegCod=sta_notif.DegCod" " AND deg_degrees.DegCod=sta_notifications.DegCod"
" AND sta_notif.NotifyEvent=%u", " AND sta_notifications.NotifyEvent=%u",
Gbl.Hierarchy.Ctr.CtrCod,(unsigned) NotifyEvent); Gbl.Hierarchy.Ctr.CtrCod,
(unsigned) NotifyEvent);
break; break;
case Hie_Lvl_DEG: case Hie_Lvl_DEG:
DB_QuerySELECT (&mysql_res,"can not get the number" DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email", " of notifications by email",
"SELECT SUM(NumEvents)," "SELECT SUM(NumEvents)," // row[0]
"SUM(NumMails)" "SUM(NumMails)" // row[1]
" FROM sta_notif" " FROM sta_notifications"
" WHERE DegCod=%ld" " WHERE DegCod=%ld"
" AND NotifyEvent=%u", " AND NotifyEvent=%u",
Gbl.Hierarchy.Deg.DegCod,(unsigned) NotifyEvent); Gbl.Hierarchy.Deg.DegCod,
(unsigned) NotifyEvent);
break; break;
case Hie_Lvl_CRS: case Hie_Lvl_CRS:
DB_QuerySELECT (&mysql_res,"can not get the number" DB_QuerySELECT (&mysql_res,"can not get the number"
" of notifications by email", " of notifications by email",
"SELECT SUM(NumEvents)," "SELECT SUM(NumEvents)," // row[0]
"SUM(NumMails)" "SUM(NumMails)" // row[1]
" FROM sta_notif" " FROM sta_notifications"
" WHERE CrsCod=%ld" " WHERE CrsCod=%ld"
" AND NotifyEvent=%u", " AND NotifyEvent=%u",
Gbl.Hierarchy.Crs.CrsCod,(unsigned) NotifyEvent); Gbl.Hierarchy.Crs.CrsCod,
(unsigned) NotifyEvent);
break; break;
default: default:
Lay_WrongScopeExit (); 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 *****/ /***** Get number of notifications sent by email from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of notifications" NumRows = DB_QuerySELECT (&mysql_res,"can not get number of notifications"
" sent by email", " sent by email",
"SELECT NumEvents,NumMails FROM sta_notif" "SELECT NumEvents," // row[0]
" WHERE DegCod=%ld AND CrsCod=%ld" "NumMails" // row[1]
" AND NotifyEvent=%u", " FROM sta_notifications"
DegCod,CrsCod,(unsigned) NotifyEvent); " WHERE DegCod=%ld"
" AND CrsCod=%ld"
" AND NotifyEvent=%u",
DegCod,
CrsCod,
(unsigned) NotifyEvent);
/***** Get number of rows *****/ /***** Get number of rows *****/
if (NumRows) if (NumRows)
@ -1944,7 +1949,7 @@ static void Ntf_UpdateNumNotifSent (long DegCod,long CrsCod,
/***** Update number of users notified *****/ /***** Update number of users notified *****/
DB_QueryREPLACE ("can not update the number of sent notifications", DB_QueryREPLACE ("can not update the number of sent notifications",
"REPLACE INTO sta_notif" "REPLACE INTO sta_notifications"
" (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)" " (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)"
" VALUES" " VALUES"
" (%ld,%ld,%u,%u,%u)", " (%ld,%ld,%u,%u,%u)",

View File

@ -50,7 +50,7 @@
#define Ntf_NUM_NOTIFY_EVENTS (1 + 20) #define Ntf_NUM_NOTIFY_EVENTS (1 + 20)
// If the numbers assigned to each event type change, // If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones // 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)!!!!!!!!!!!!!! typedef enum // TODO: Change numbers (also in database)!!!!!!!!!!!!!!
{ {
Ntf_EVENT_UNKNOWN = 0, Ntf_EVENT_UNKNOWN = 0,