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

This commit is contained in:
acanas 2021-02-26 23:45:45 +01:00
parent fad1befb90
commit 05c85c9734
4 changed files with 37 additions and 17 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.3 (2021-02-26)" #define Log_PLATFORM_VERSION "SWAD 20.36.4 (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.4: Feb 26, 2021 Query moved to module swad_timeline_database. (305156 lines)
Version 20.36.3: Feb 26, 2021 Query moved to module swad_timeline_database. (305140 lines) Version 20.36.3: Feb 26, 2021 Query moved to module swad_timeline_database. (305140 lines)
Version 20.36.2: Feb 26, 2021 Query moved to module swad_timeline_database. (305126 lines) 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)

View File

@ -938,27 +938,15 @@ static void TL_Com_RemoveComment (void)
void TL_Com_RemoveCommentMediaAndDBEntries (long PubCod) void TL_Com_RemoveCommentMediaAndDBEntries (long PubCod)
{ {
MYSQL_RES *mysql_res;
MYSQL_ROW row;
long MedCod; long MedCod;
/***** Remove media associated to comment *****/ /***** Remove media associated to comment *****/
if (DB_QuerySELECT (&mysql_res,"can not get media", /* Get media code */
"SELECT MedCod" // row[0] MedCod = TL_DB_GetMedCodFromComment (PubCod);
" FROM tl_comments"
" WHERE PubCod=%ld",
PubCod) == 1) // Result should have a unique row
{
/* Get media code */
row = mysql_fetch_row (mysql_res);
MedCod = Str_ConvertStrCodToLongCod (row[0]);
/* Remove media */ /* Remove media */
if (MedCod > 0)
Med_RemoveMedia (MedCod); Med_RemoveMedia (MedCod);
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
/***** Mark possible notifications on this comment as removed *****/ /***** Mark possible notifications on this comment as removed *****/
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_COMMENT,PubCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_COMMENT,PubCod);

View File

@ -66,6 +66,7 @@ unsigned TL_DB_GetNumCommentsInNote (long NotCod)
/*****************************************************************************/ /*****************************************************************************/
/************** Get initial comments of a note from database *****************/ /************** Get initial comments of a note from database *****************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got
unsigned TL_DB_GetInitialComments (long NotCod, unsigned TL_DB_GetInitialComments (long NotCod,
unsigned NumInitialCommentsToGet, unsigned NumInitialCommentsToGet,
@ -92,6 +93,7 @@ unsigned TL_DB_GetInitialComments (long NotCod,
/*****************************************************************************/ /*****************************************************************************/
/*************** Get final comments of a note from database ******************/ /*************** Get final comments of a note from database ******************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got
unsigned TL_DB_GetFinalComments (long NotCod, unsigned TL_DB_GetFinalComments (long NotCod,
unsigned NumFinalCommentsToGet, unsigned NumFinalCommentsToGet,
@ -136,3 +138,31 @@ void TL_DB_InsertCommentContent (long PubCod,
Content->Txt, Content->Txt,
Content->Media.MedCod); Content->Media.MedCod);
} }
/*****************************************************************************/
/******************* Insert comment content in database **********************/
/*****************************************************************************/
long TL_DB_GetMedCodFromComment (long PubCod)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
long MedCod = -1L;
/***** Get code of media associated to comment *****/
if (DB_QuerySELECT (&mysql_res,"can not get media code",
"SELECT MedCod" // row[0]
" FROM tl_comments"
" WHERE PubCod=%ld",
PubCod) == 1) // Result should have a unique row
{
/* Get media code */
row = mysql_fetch_row (mysql_res);
MedCod = Str_ConvertStrCodToLongCod (row[0]);
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
return MedCod;
}

View File

@ -51,5 +51,6 @@ unsigned TL_DB_GetFinalComments (long NotCod,
MYSQL_RES **mysql_res); MYSQL_RES **mysql_res);
void TL_DB_InsertCommentContent (long PubCod, void TL_DB_InsertCommentContent (long PubCod,
const struct TL_Pst_PostContent *Content); const struct TL_Pst_PostContent *Content);
long TL_DB_GetMedCodFromComment (long PubCod);
#endif #endif