diff --git a/swad_changelog.h b/swad_changelog.h index ed47e4eae..8f957902b 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 (2021-02-26)" +#define Log_PLATFORM_VERSION "SWAD 20.36.1 (2021-02-26)" #define CSS_FILE "swad20.33.9.css" #define JS_FILE "swad20.6.2.js" /* @@ -601,6 +601,7 @@ 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.1: Feb 26, 2021 Function moved to module swad_timeline_database. (305113 lines) Version 20.36: Feb 26, 2021 New module swad_timeline_database. (305133 lines) Version 20.35.1: Feb 23, 2021 Code refactoring in timeline related to sharing and faving. (305021 lines) Version 20.35: Feb 23, 2021 Code refactoring in timeline related to sharing and faving. (304986 lines) diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index 2f898ecb3..d865fb3b1 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -67,8 +67,6 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static unsigned long TL_Com_GetNumCommentsInNote (long NotCod); - static unsigned TL_Com_WriteHiddenComments (struct TL_Timeline *Timeline, long NotCod, char IdComments[Frm_MAX_BYTES_ID + 1], @@ -200,7 +198,7 @@ void TL_Com_WriteCommentsInNote (const struct TL_Timeline *Timeline, char IdComments[Frm_MAX_BYTES_ID + 1]; /***** Get number of comments in note *****/ - NumComments = TL_Com_GetNumCommentsInNote (Not->NotCod); + NumComments = TL_DB_GetNumCommentsInNote (Not->NotCod); /***** Trivial check: if no comments ==> nothing to do *****/ if (!NumComments) @@ -225,28 +223,6 @@ void TL_Com_WriteCommentsInNote (const struct TL_Timeline *Timeline, NumFinalCommentsGot = TL_DB_GetFinalComments (Not->NotCod, NumFinalCommentsToGet, &mysql_res); - /* - NumFinalCommentsGot = (unsigned) - DB_QuerySELECT (&mysql_res,"can not get comments", - "SELECT * FROM " - "(" - "SELECT tl_pubs.PubCod," // row[0] - "tl_pubs.PublisherCod," // row[1] - "tl_pubs.NotCod," // row[2] - "UNIX_TIMESTAMP(" - "tl_pubs.TimePublish)," // row[3] - "tl_comments.Txt," // row[4] - "tl_comments.MedCod" // row[5] - " FROM tl_pubs,tl_comments" - " WHERE tl_pubs.NotCod=%ld" - " AND tl_pubs.PubType=%u" - " AND tl_pubs.PubCod=tl_comments.PubCod" - " ORDER BY tl_pubs.PubCod DESC LIMIT %u" - ") AS comments" - " ORDER BY PubCod", - Not->NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE, - NumFinalCommentsToGet); - */ /* Before clicking "See prev..." --> After clicking "See prev..." _________________________________ _________________________________ @@ -321,18 +297,6 @@ void TL_Com_WriteCommentsInNote (const struct TL_Timeline *Timeline, DB_FreeMySQLResult (&mysql_res); } -/*****************************************************************************/ -/********************* Get number of comments in a note **********************/ -/*****************************************************************************/ - -static unsigned long TL_Com_GetNumCommentsInNote (long NotCod) - { - return DB_QueryCOUNT ("can not get number of comments in a note", - "SELECT COUNT(*) FROM tl_pubs" - " WHERE NotCod=%ld AND PubType=%u", - NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); - } - /*****************************************************************************/ /********************** Write hidden comments via AJAX ***********************/ /*****************************************************************************/ diff --git a/swad_timeline_database.c b/swad_timeline_database.c index e3341b210..bcf5dedf9 100644 --- a/swad_timeline_database.c +++ b/swad_timeline_database.c @@ -49,6 +49,19 @@ /***************************** Private prototypes ****************************/ /*****************************************************************************/ +/*****************************************************************************/ +/********************* Get number of comments in a note **********************/ +/*****************************************************************************/ + +unsigned TL_DB_GetNumCommentsInNote (long NotCod) + { + return (unsigned) + DB_QueryCOUNT ("can not get number of comments in a note", + "SELECT COUNT(*) FROM tl_pubs" + " WHERE NotCod=%ld AND PubType=%u", + NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); + } + /*****************************************************************************/ /*************** Get final comments of a note from database ******************/ /*****************************************************************************/ diff --git a/swad_timeline_database.h b/swad_timeline_database.h index 1a88ed958..e492ece98 100644 --- a/swad_timeline_database.h +++ b/swad_timeline_database.h @@ -41,6 +41,7 @@ /****************************** Public prototypes ****************************/ /*****************************************************************************/ +unsigned TL_DB_GetNumCommentsInNote (long NotCod); unsigned TL_DB_GetFinalComments (long NotCod, unsigned NumFinalCommentsToGet, MYSQL_RES **mysql_res);