From 5cbad0ccdb427f45e2cc22962a8fb659386134c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 12 Jan 2016 19:43:17 +0100 Subject: [PATCH] Version 15.110.6 --- swad_changelog.h | 3 ++- swad_social.c | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 87e54b5d6..3bedf491b 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -122,13 +122,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.110.5 (2016-01-12)" +#define Log_PLATFORM_VERSION "SWAD 15.110.6 (2016-01-12)" #define CSS_FILE "swad15.110.2.css" #define JS_FILE "swad15.107.2.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 /* + Version 15.110.6: Jan 12, 2016 Social timeline for this session in database is cleared when timeline is reloaded. (192303 lines) Version 15.110.5: Jan 12, 2016 New database table used to store social notes already present in every timeline. (192288 lines) 1 change necessary in database: CREATE TABLE IF NOT EXISTS social_timelines (SessionId CHAR(43) NOT NULL,NotCod BIGINT NOT NULL,UNIQUE INDEX(SessionId,NotCod)); diff --git a/swad_social.c b/swad_social.c index 69ff7341c..4d3008c09 100644 --- a/swad_social.c +++ b/swad_social.c @@ -276,6 +276,8 @@ static void Soc_ResetSocialComment (struct SocialComment *SocCom); static void Soc_SetUniqueId (char UniqueId[Soc_MAX_LENGTH_ID]); +static void Soc_ClearTimelineForThisSession (void); + /*****************************************************************************/ /*********** Show social activity (timeline) of a selected user **************/ /*****************************************************************************/ @@ -518,7 +520,10 @@ static void Soc_ShowTimeline (const char *Query,const char *Title) struct SocialPublishing SocPub; struct SocialNote SocNot; - /***** Get timeline from database *****/ + /***** Clear timeline for this session in database *****/ + Soc_ClearTimelineForThisSession (); + + /***** Get publishings from database *****/ NumPubsGot = DB_QuerySELECT (Query,&mysql_res,"can not get timeline"); /***** Start frame *****/ @@ -2977,3 +2982,17 @@ static void Soc_SetUniqueId (char UniqueId[Soc_MAX_LENGTH_ID]) Gbl.UniqueNameEncrypted, ++CountForThisExecution); } + +/*****************************************************************************/ +/************* Clear social timeline for this session in database ************/ +/*****************************************************************************/ + +static void Soc_ClearTimelineForThisSession (void) + { + char Query[128]; + + /***** Remove social timeline for this session *****/ + sprintf (Query,"DELETE FROM social_timelines WHERE SessionId='%s'", + Gbl.Session.Id); + DB_QueryDELETE (Query,"can not remove social timeline"); + }