From 26ea342f12146ce796126c8f57131ecf323f83d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 9 Mar 2015 01:32:31 +0100 Subject: [PATCH] Version 14.80.9 --- swad_changelog.h | 3 ++- swad_message.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/swad_changelog.h b/swad_changelog.h index 9ec14d9d5..8359e7d91 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,11 +103,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.80.8 (2015/03/09)" +#define Log_PLATFORM_VERSION "SWAD 14.80.9 (2015/03/09)" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1 /* + Version 14.80.9: Mar 09, 2015 Scope country for statistic of messages. (179187 lines) Version 14.80.8: Mar 09, 2015 Scope country for statistic of forums. (179138 lines) Version 14.80.7: Mar 09, 2015 Scope country for statistic of surveys. (179021 lines) Version 14.80.6: Mar 09, 2015 Scope country for statistic of columns. (178987 lines) diff --git a/swad_message.c b/swad_message.c index 319f12ad1..ab1f8e0c8 100644 --- a/swad_message.c +++ b/swad_message.c @@ -1821,6 +1821,18 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus) sprintf (Query,"SELECT COUNT(*) FROM %s", Table); break; + case Sco_SCOPE_CTY: + sprintf (Query,"SELECT COUNT(*)" + " FROM institutions,centres,degrees,courses,%s" + " WHERE institutions.CtyCod='%ld'" + " AND institutions.InsCod=centres.InsCod" + " AND centres.CtrCod=degrees.CtrCod" + " AND degrees.DegCod=courses.DegCod" + " AND courses.CrsCod=%s.CrsCod", + Table, + Gbl.CurrentCty.Cty.CtyCod, + Table); + break; case Sco_SCOPE_INS: sprintf (Query,"SELECT COUNT(*)" " FROM centres,degrees,courses,%s" @@ -1889,6 +1901,19 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus) sprintf (Query,"SELECT COUNT(*) FROM %s", Table); break; + case Sco_SCOPE_CTY: + sprintf (Query,"SELECT COUNT(*)" + " FROM institutions,centres,degrees,courses,%s,msg_snt" + " WHERE institutions.CtyCod='%ld'" + " AND institutions.InsCod=centres.InsCod" + " AND centres.CtrCod=degrees.CtrCod" + " AND degrees.DegCod=courses.DegCod" + " AND courses.CrsCod=msg_snt.CrsCod" + " AND msg_snt.MsgCod=%s.MsgCod", + Table, + Gbl.CurrentCty.Cty.CtyCod, + Table); + break; case Sco_SCOPE_INS: sprintf (Query,"SELECT COUNT(*)" " FROM centres,degrees,courses,%s,msg_snt" @@ -1949,6 +1974,30 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus) " FROM msg_rcv_deleted" " WHERE Notified='Y')"); break; + case Sco_SCOPE_CTY: + sprintf (Query,"SELECT " + "(SELECT COUNT(*)" + " FROM institutions,centres,degrees,courses,msg_snt,msg_rcv" + " WHERE institutions.CtyCod='%ld'" + " AND institutions.InsCod=centres.InsCod" + " AND centres.CtrCod=degrees.CtrCod" + " AND degrees.DegCod=courses.DegCod" + " AND courses.CrsCod=msg_snt.CrsCod" + " AND msg_snt.MsgCod=msg_rcv.MsgCod" + " AND msg_rcv.Notified='Y')" + " + " + "(SELECT COUNT(*)" + " FROM institutions,centres,degrees,courses,msg_snt,msg_rcv_deleted" + " WHERE institutions.CtyCod='%ld'" + " AND institutions.InsCod=centres.InsCod" + " AND centres.CtrCod=degrees.CtrCod" + " AND degrees.DegCod=courses.DegCod" + " AND courses.CrsCod=msg_snt.CrsCod" + " AND msg_snt.MsgCod=msg_rcv_deleted.MsgCod" + " AND msg_rcv_deleted.Notified='Y')", + Gbl.CurrentCty.Cty.CtyCod, + Gbl.CurrentCty.Cty.CtyCod); + break; case Sco_SCOPE_INS: sprintf (Query,"SELECT " "(SELECT COUNT(*)"