From 7254a2fff0a1258fe8856c35340e1fa39022c97d Mon Sep 17 00:00:00 2001 From: acanas Date: Sun, 28 Feb 2021 19:59:49 +0100 Subject: [PATCH] Version 20.36.23: Feb 28, 2021 Function moved to module swad_timeline_database. --- swad_changelog.h | 5 +++-- swad_profile.c | 4 ++-- swad_timeline_database.c | 13 +++++++++++++ swad_timeline_database.h | 1 + swad_timeline_publication.c | 14 -------------- swad_timeline_publication.h | 2 -- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 261e36df..d693b46f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 20.36.22 (2021-02-27)" +#define Log_PLATFORM_VERSION "SWAD 20.36.23 (2021-02-28)" #define CSS_FILE "swad20.33.9.css" #define JS_FILE "swad20.6.2.js" /* @@ -601,7 +601,8 @@ TODO: DNI de un estudiante sale err TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede. TODO: Salvador Romero Cortés: @acanas opción para editar posts - Version 20.36.22: Feb 27, 2021 Function moved to module swad_timeline_database. (305387 lines) + Version 20.36.23: Feb 28, 2021 Function moved to module swad_timeline_database. (305387 lines) + Version 20.36.22: Feb 28, 2021 Query moved to module swad_timeline_database. (305387 lines) Version 20.36.21: Feb 27, 2021 Function moved to module swad_timeline_database. (305376 lines) Version 20.36.20: Feb 27, 2021 Query moved to module swad_timeline_database. (305374 lines) Version 20.36.19: Feb 27, 2021 Queries moved to module swad_timeline_database. (305363 lines) diff --git a/swad_profile.c b/swad_profile.c index f053d753..b0c8504d 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -53,7 +53,7 @@ #include "swad_setting.h" #include "swad_theme.h" #include "swad_timeline.h" -#include "swad_timeline_publication.h" +#include "swad_timeline_database.h" #include "swad_user.h" /*****************************************************************************/ @@ -1127,7 +1127,7 @@ static void Prf_GetNumSocialPubsAndStoreAsUsrFigure (long UsrCod) Prf_ResetUsrFigures (&UsrFigures); /***** Get number of forum posts from database *****/ - UsrFigures.NumSocPub = TL_Pub_GetNumPubsUsr (UsrCod); + UsrFigures.NumSocPub = TL_DB_GetNumPubsUsr (UsrCod); /***** Update number of forum posts in user's figures *****/ if (Prf_CheckIfUsrFiguresExists (UsrCod)) diff --git a/swad_timeline_database.c b/swad_timeline_database.c index d0db7d22..d51602f1 100644 --- a/swad_timeline_database.c +++ b/swad_timeline_database.c @@ -675,6 +675,19 @@ long TL_DB_GetPubCodFromSession (const char *FieldName, return PubCod; } +/*****************************************************************************/ +/****************** Get number of publications from a user *******************/ +/*****************************************************************************/ + +unsigned long TL_DB_GetNumPubsUsr (long UsrCod) + { + /***** Get number of posts from a user from database *****/ + return DB_QueryCOUNT ("can not get number of publications from a user", + "SELECT COUNT(*) FROM tl_pubs" + " WHERE PublisherCod=%ld", + UsrCod); + } + /*****************************************************************************/ /********************* Insert new publication in database ********************/ /*****************************************************************************/ diff --git a/swad_timeline_database.h b/swad_timeline_database.h index 10ed8a63..483e028d 100644 --- a/swad_timeline_database.h +++ b/swad_timeline_database.h @@ -97,6 +97,7 @@ unsigned TL_DB_SelectTheMostRecentPub (const struct TL_Pub_SubQueries *SubQuerie long TL_DB_GetNotCodFromPubCod (long PubCod); long TL_DB_GetPubCodFromSession (const char *FieldName, const char SessionId[Cns_BYTES_SESSION_ID + 1]); +unsigned long TL_DB_GetNumPubsUsr (long UsrCod); long TL_DB_CreateNewPub (const struct TL_Pub_Publication *Pub); void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod, const char SessionId[Cns_BYTES_SESSION_ID + 1]); diff --git a/swad_timeline_publication.c b/swad_timeline_publication.c index 9232fb84..4c813b62 100644 --- a/swad_timeline_publication.c +++ b/swad_timeline_publication.c @@ -28,7 +28,6 @@ #include // For malloc and free #include // For string functions -#include "swad_database.h" #include "swad_follow.h" #include "swad_global.h" #include "swad_profile.h" @@ -641,16 +640,3 @@ void TL_Pub_PublishPubInTimeline (struct TL_Pub_Publication *Pub) /***** Increment number of publications in user's figures *****/ Prf_IncrementNumPubsUsr (Pub->PublisherCod); } - -/*****************************************************************************/ -/****************** Get number of publications from a user *******************/ -/*****************************************************************************/ - -unsigned long TL_Pub_GetNumPubsUsr (long UsrCod) - { - /***** Get number of posts from a user from database *****/ - return DB_QueryCOUNT ("can not get number of publications from a user", - "SELECT COUNT(*) FROM tl_pubs" - " WHERE PublisherCod=%ld", - UsrCod); - } diff --git a/swad_timeline_publication.h b/swad_timeline_publication.h index d004d736..78268aca 100644 --- a/swad_timeline_publication.h +++ b/swad_timeline_publication.h @@ -98,6 +98,4 @@ void TL_Pub_GetDataOfPublicationFromNextRow (MYSQL_RES *mysql_res, void TL_Pub_PublishPubInTimeline (struct TL_Pub_Publication *Pub); -unsigned long TL_Pub_GetNumPubsUsr (long UsrCod); - #endif