Version 20.36.2: Feb 26, 2021 Query moved to module swad_timeline_database.

This commit is contained in:
acanas 2021-02-26 22:34:11 +01:00
parent 52c868d677
commit fd3aa49331
4 changed files with 52 additions and 37 deletions

View File

@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.36.1 (2021-02-26)" #define Log_PLATFORM_VERSION "SWAD 20.36.2 (2021-02-26)"
#define CSS_FILE "swad20.33.9.css" #define CSS_FILE "swad20.33.9.css"
#define JS_FILE "swad20.6.2.js" #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: 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 TODO: Salvador Romero Cortés: @acanas opción para editar posts
Version 20.36.2: Feb 26, 2021 Query moved to module swad_timeline_database. (305126 lines)
Version 20.36.1: Feb 26, 2021 Function moved to module swad_timeline_database. (305113 lines) 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.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.1: Feb 23, 2021 Code refactoring in timeline related to sharing and faving. (305021 lines)

View File

@ -354,25 +354,11 @@ static unsigned TL_Com_WriteHiddenComments (struct TL_Timeline *Timeline,
unsigned long NumCom; unsigned long NumCom;
/***** Get comments of this note from database *****/ /***** Get comments of this note from database *****/
NumInitialCommentsGot = (unsigned) NumInitialCommentsGot = TL_DB_GetInitialComments (NotCod,
DB_QuerySELECT (&mysql_res,"can not get comments", NumInitialCommentsToGet,
"SELECT tl_pubs.PubCod," // row[0] &mysql_res);
"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"
" LIMIT %lu",
NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE,
NumInitialCommentsToGet);
/***** List with comments *****/ /***** List comments *****/
HTM_UL_Begin ("id=\"com_%s\" class=\"TL_LIST\"",IdComments); HTM_UL_Begin ("id=\"com_%s\" class=\"TL_LIST\"",IdComments);
for (NumCom = 0; for (NumCom = 0;
NumCom < NumInitialCommentsGot; NumCom < NumInitialCommentsGot;

View File

@ -62,6 +62,32 @@ unsigned TL_DB_GetNumCommentsInNote (long NotCod)
NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE);
} }
/*****************************************************************************/
/************** Get initial comments of a note from database *****************/
/*****************************************************************************/
unsigned TL_DB_GetInitialComments (long NotCod,
unsigned NumInitialCommentsToGet,
MYSQL_RES **mysql_res)
{
return (unsigned)
DB_QuerySELECT (mysql_res,"can not get comments",
"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"
" LIMIT %lu",
NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE,
NumInitialCommentsToGet);
}
/*****************************************************************************/ /*****************************************************************************/
/*************** Get final comments of a note from database ******************/ /*************** Get final comments of a note from database ******************/
/*****************************************************************************/ /*****************************************************************************/
@ -78,8 +104,7 @@ unsigned TL_DB_GetFinalComments (long NotCod,
"SELECT tl_pubs.PubCod," // row[0] "SELECT tl_pubs.PubCod," // row[0]
"tl_pubs.PublisherCod," // row[1] "tl_pubs.PublisherCod," // row[1]
"tl_pubs.NotCod," // row[2] "tl_pubs.NotCod," // row[2]
"UNIX_TIMESTAMP(" "UNIX_TIMESTAMP(tl_pubs.TimePublish)," // row[3]
"tl_pubs.TimePublish)," // row[3]
"tl_comments.Txt," // row[4] "tl_comments.Txt," // row[4]
"tl_comments.MedCod" // row[5] "tl_comments.MedCod" // row[5]
" FROM tl_pubs,tl_comments" " FROM tl_pubs,tl_comments"

View File

@ -42,6 +42,9 @@
/*****************************************************************************/ /*****************************************************************************/
unsigned TL_DB_GetNumCommentsInNote (long NotCod); unsigned TL_DB_GetNumCommentsInNote (long NotCod);
unsigned TL_DB_GetInitialComments (long NotCod,
unsigned NumInitialCommentsToGet,
MYSQL_RES **mysql_res);
unsigned TL_DB_GetFinalComments (long NotCod, unsigned TL_DB_GetFinalComments (long NotCod,
unsigned NumFinalCommentsToGet, unsigned NumFinalCommentsToGet,
MYSQL_RES **mysql_res); MYSQL_RES **mysql_res);