Version 20.36.25: Feb 28, 2021 Queries moved to module swad_timeline_database.

This commit is contained in:
acanas 2021-02-28 21:24:49 +01:00
parent e02fd7f3dc
commit 8a1639ff37
4 changed files with 46 additions and 21 deletions

View File

@ -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.24 (2021-02-28)"
#define Log_PLATFORM_VERSION "SWAD 20.36.25 (2021-02-28)"
#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.25: Feb 28, 2021 Queries moved to module swad_timeline_database. (305405 lines)
Version 20.36.24: Feb 28, 2021 Functions moved to module swad_timeline_database. (305385 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)

View File

@ -847,3 +847,35 @@ void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod)
FirstPubCod,
Gbl.Session.Id);
}
/*****************************************************************************/
/********************** Mark note as favourite in database *******************/
/*****************************************************************************/
void TL_DB_MarkNoteAsFav (long NotCod)
{
/***** Insert note in favourited in database *****/
DB_QueryINSERT ("can not favourite note",
"INSERT IGNORE INTO tl_notes_fav"
" (NotCod,UsrCod,TimeFav)"
" VALUES"
" (%ld,%ld,NOW())",
NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
/*****************************************************************************/
/********************** Mark note as favourite in database *******************/
/*****************************************************************************/
void TL_DB_MarkCommAsFav (long PubCod)
{
/***** Insert comment in favourited in database *****/
DB_QueryINSERT ("can not favourite comment",
"INSERT IGNORE INTO tl_comments_fav"
" (PubCod,UsrCod,TimeFav)"
" VALUES"
" (%ld,%ld,NOW())",
PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}

View File

@ -45,7 +45,7 @@
/****************************** Public prototypes ****************************/
/*****************************************************************************/
/* Notes */
/*********************************** Notes ***********************************/
unsigned TL_DB_GetDataOfNoteByCod (long NotCod,MYSQL_RES **mysql_res);
long TL_DB_GetPubCodOfOriginalNote (long NotCod);
long TL_DB_CreateNewNote (TL_Not_NoteType_t NoteType,long Cod,
@ -68,13 +68,13 @@ void TL_DB_RemoveNoteFavs (long NotCod);
void TL_DB_RemoveNotePubs (long NotCod);
void TL_DB_RemoveNote (long NotCod);
/* Posts */
/********************************** Posts ************************************/
unsigned TL_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res);
long TL_DB_GetMedCodFromPost (long PubCod);
long TL_DB_CreateNewPost (const struct TL_Pst_PostContent *Content);
void TL_DB_RemovePost (long PstCod);
/* Comments */
/******************************** Comments ***********************************/
unsigned TL_DB_GetNumCommentsInNote (long NotCod);
unsigned TL_DB_GetComments (long NotCod,MYSQL_RES **mysql_res);
unsigned TL_DB_GetInitialComments (long NotCod,
@ -91,7 +91,7 @@ void TL_DB_RemoveCommentFavs (long PubCod);
void TL_DB_RemoveCommentContent (long PubCod);
void TL_DB_RemoveCommentPub (long PubCod);
/* Publications */
/****************************** Publications *********************************/
void TL_DB_CreateSubQueryPublishers (const struct TL_Timeline *Timeline,
struct TL_Pub_SubQueries *SubQueries);
void TL_DB_CreateSubQueryAlreadyExists (const struct TL_Timeline *Timeline,
@ -110,4 +110,8 @@ void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod);
void TL_DB_UpdateLastPubCodInSession (void);
void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod);
/****************************** Favourites ***********************************/
void TL_DB_MarkNoteAsFav (long NotCod);
void TL_DB_MarkCommAsFav (long PubCod);
#endif

View File

@ -174,14 +174,8 @@ static void TL_Fav_FavNote (struct TL_Not_Note *Not)
if (!TL_Fav_CheckIfNoteIsFavedByUsr (Not->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note
{
/***** Mark as favourite in database *****/
DB_QueryINSERT ("can not favourite note",
"INSERT IGNORE INTO tl_notes_fav"
" (NotCod,UsrCod,TimeFav)"
" VALUES"
" (%ld,%ld,NOW())",
Not->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Mark note as favourite in database *****/
TL_DB_MarkNoteAsFav (Not->NotCod);
/***** Update number of times this note is favourited *****/
TL_Fav_GetNumTimesANoteHasBeenFav (Not);
@ -325,14 +319,8 @@ static void TL_Fav_FavComment (struct TL_Com_Comment *Com)
if (!TL_Fav_CheckIfCommIsFavedByUsr (Com->PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the comment
{
/***** Mark as favourite in database *****/
DB_QueryINSERT ("can not favourite comment",
"INSERT IGNORE INTO tl_comments_fav"
" (PubCod,UsrCod,TimeFav)"
" VALUES"
" (%ld,%ld,NOW())",
Com->PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Mark comment as favourite in database *****/
TL_DB_MarkCommAsFav (Com->PubCod);
/* Update number of times this comment is favourited */
TL_Fav_GetNumTimesACommHasBeenFav (Com);