From 5c0fafb58ad6d95144667124a524bc4326f7575d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 9 Mar 2015 18:39:59 +0100 Subject: [PATCH] Version 14.81.1 --- swad_changelog.h | 3 ++- swad_message.c | 18 ++++++++++++++++++ swad_message.h | 1 + swad_user.c | 17 +++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/swad_changelog.h b/swad_changelog.h index d445387df..ebf226ad4 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,11 +103,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.81 (2015/03/09)" +#define Log_PLATFORM_VERSION "SWAD 14.81.1 (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.81.1: Mar 09, 2015 Information about number of messages sent in user's public profile. (179545 lines) Version 14.81: Mar 09, 2015 Information about number of forum posts in user's public profile. (179512 lines) Version 14.80.19: Mar 09, 2015 Fixed bug in web service, reported by Juan Miguel Boyero Corral. (179482 lines) Version 14.80.18: Mar 09, 2015 Fixed bug in statistic of degrees and courses. (179481 lines) diff --git a/swad_message.c b/swad_message.c index ab1f8e0c8..1698f2bab 100644 --- a/swad_message.c +++ b/swad_message.c @@ -1793,6 +1793,24 @@ unsigned Msg_GetNumMsgsSentByTchsCrs (long CrsCod) return (unsigned) DB_QueryCOUNT (Query,"can not get the number of messages sent by teachers"); } +/*****************************************************************************/ +/************** Get the number of unique messages sent by a user *************/ +/*****************************************************************************/ + +unsigned Msg_GetNumMsgsSentByUsr (long UsrCod) + { + char Query[256]; + + /***** Get the number of unique messages sent by any teacher from this course *****/ + sprintf (Query,"SELECT" + " (SELECT COUNT(*) FROM msg_snt WHERE UsrCod='%ld')" + " +" + " (SELECT COUNT(*) FROM msg_snt_deleted WHERE UsrCod='%ld')", + UsrCod, + UsrCod); + return (unsigned) DB_QueryCOUNT (Query,"can not get the number of messages sent by a user"); + } + /*****************************************************************************/ /******** Get the number of unique messages sent from this location **********/ /******** (all the platform, current degree or current course) **********/ diff --git a/swad_message.h b/swad_message.h index ce2d6a7cc..6a78deb19 100644 --- a/swad_message.h +++ b/swad_message.h @@ -89,6 +89,7 @@ void Msg_ShowSntMsgs (void); void Msg_ShowRecMsgs (void); unsigned Msg_GetNumMsgsSentByTchsCrs (long CrsCod); +unsigned Msg_GetNumMsgsSentByUsr (long UsrCod); unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus); unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus); void Msg_WriteNumMsgs (unsigned NumMsgs,unsigned NumUnreadMsgs); diff --git a/swad_user.c b/swad_user.c index d5506726f..731a906af 100644 --- a/swad_user.c +++ b/swad_user.c @@ -7521,6 +7521,7 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) extern const char *Txt_Shortcut; extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES]; extern const char *Txt_Forum_posts; + extern const char *Txt_Messages_sent; /***** Start table *****/ Lay_StartRoundFrameTable10 (NULL,2,NULL); @@ -7559,6 +7560,22 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat) Txt_Forum_posts, For_GetNumPostsUsr (UsrDat->UsrCod)); + /***** Number of messages sent *****/ + fprintf (Gbl.F.Out,"" + "" + "%s:" + "" + "" + "%u" + "" + "" + "", + The_ClassFormul[Gbl.Prefs.Theme], + Txt_Messages_sent, + Msg_GetNumMsgsSentByUsr (UsrDat->UsrCod)); + /***** End of table *****/ Lay_EndRoundFrameTable10 (); }