From 60aa976efc122999f08770aca00e1e6e700de0fa Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 25 Mar 2021 23:52:15 +0100 Subject: [PATCH] Version 20.51.45: Mar 25, 2021 Project users database table renamed. --- sql/swad.sql | 4 +-- swad_changelog.h | 8 +++-- swad_database.c | 6 ++-- swad_figure.c | 84 ++++++++++++++++++++++++--------------------- swad_notification.c | 15 +++++--- swad_notification.h | 2 +- 6 files changed, 67 insertions(+), 52 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index cda6e065..793cf45f 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -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, diff --git a/swad_changelog.h b/swad_changelog.h index 7b195fd7..c687c855 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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; diff --git a/swad_database.c b/swad_database.c index 14027ade..6c86f648 100644 --- a/swad_database.c +++ b/swad_database.c @@ -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," diff --git a/swad_figure.c b/swad_figure.c index 8c64a004..8c86050e 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -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 (); diff --git a/swad_notification.c b/swad_notification.c index 606465ac..5ba5de87 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -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)", diff --git a/swad_notification.h b/swad_notification.h index 2c322fac..5d6d3b93 100644 --- a/swad_notification.h +++ b/swad_notification.h @@ -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,