mirror of https://github.com/acanas/swad-core.git
Version 21.57.2: Nov 14, 2021 Code refactoring in timeline.
This commit is contained in:
parent
bbf39d2fe4
commit
b911c3480a
|
@ -13508,4 +13508,18 @@ SELECT gam_questions.QstCod,gam_questions.QstInd,tst_questions.AnsType,tst_quest
|
||||||
|
|
||||||
SELECT COUNT(tst_answers.AnsInd) AS N FROM tst_answers,gam_questions WHERE gam_questions.GamCod=8 AND gam_questions.QstCod=tst_answers.QstCod GROUP BY tst_answers.QstCod;
|
SELECT COUNT(tst_answers.AnsInd) AS N FROM tst_answers,gam_questions WHERE gam_questions.GamCod=8 AND gam_questions.QstCod=tst_answers.QstCod GROUP BY tst_answers.QstCod;
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
SELECT MAX(PubCod) AS NewestPubCod
|
||||||
|
FROM tml_pubs
|
||||||
|
GROUP BY NotCod
|
||||||
|
ORDER BY NewestPubCod DESC
|
||||||
|
LIMIT 10;
|
||||||
|
|
||||||
|
SELECT PubCod
|
||||||
|
FROM tml_pubs
|
||||||
|
WHERE NotCod NOT IN (SELECT NotCod FROM tml_tmp_just_retrieved_notes)
|
||||||
|
ORDER BY PubCod DESC
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.57.1 (2021-11-12)"
|
#define Log_PLATFORM_VERSION "SWAD 21.57.2 (2021-11-14)"
|
||||||
#define CSS_FILE "swad21.57.css"
|
#define CSS_FILE "swad21.57.css"
|
||||||
#define JS_FILE "swad21.57.js"
|
#define JS_FILE "swad21.57.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 21.57.2: Nov 14, 2021 Code refactoring in timeline. (319257 lines)
|
||||||
Version 21.57.1: Nov 12, 2021 Code refactoring in multimedia. (319241 lines)
|
Version 21.57.1: Nov 12, 2021 Code refactoring in multimedia. (319241 lines)
|
||||||
Version 21.57: Nov 11, 2021 Code refactoring in timeline. (319208 lines)
|
Version 21.57: Nov 11, 2021 Code refactoring in timeline. (319208 lines)
|
||||||
Version 21.56.5: Nov 10, 2021 Code refactoring in switch statements. (319181 lines)
|
Version 21.56.5: Nov 10, 2021 Code refactoring in switch statements. (319181 lines)
|
||||||
|
|
|
@ -184,7 +184,7 @@ void Tml_ResetTimeline (struct Tml_Timeline *Timeline)
|
||||||
{
|
{
|
||||||
Timeline->UsrOrGbl = Tml_Usr_TIMELINE_GBL;
|
Timeline->UsrOrGbl = Tml_Usr_TIMELINE_GBL;
|
||||||
Timeline->Who = Tml_Who_DEFAULT_WHO;
|
Timeline->Who = Tml_Who_DEFAULT_WHO;
|
||||||
Timeline->WhatToGet = Tml_GET_RECENT_TIMELINE;
|
Timeline->WhatToGet = Tml_GET_RECENT_PUBS;
|
||||||
Timeline->Pubs.Top =
|
Timeline->Pubs.Top =
|
||||||
Timeline->Pubs.Bottom = NULL,
|
Timeline->Pubs.Bottom = NULL,
|
||||||
Timeline->NotCod = -1L;
|
Timeline->NotCod = -1L;
|
||||||
|
@ -248,7 +248,7 @@ void Tml_ShowTimelineGblHighlighting (struct Tml_Timeline *Timeline,long NotCod)
|
||||||
|
|
||||||
/***** Get list of pubications to show in timeline *****/
|
/***** Get list of pubications to show in timeline *****/
|
||||||
Timeline->UsrOrGbl = Tml_Usr_TIMELINE_GBL;
|
Timeline->UsrOrGbl = Tml_Usr_TIMELINE_GBL;
|
||||||
Timeline->WhatToGet = Tml_GET_RECENT_TIMELINE;
|
Timeline->WhatToGet = Tml_GET_RECENT_PUBS;
|
||||||
Tml_Pub_GetListPubsToShowInTimeline (Timeline);
|
Tml_Pub_GetListPubsToShowInTimeline (Timeline);
|
||||||
|
|
||||||
/***** Show timeline *****/
|
/***** Show timeline *****/
|
||||||
|
@ -277,7 +277,7 @@ void Tml_ShowTimelineUsrHighlighting (struct Tml_Timeline *Timeline,long NotCod)
|
||||||
|
|
||||||
/***** Get list of pubications to show in timeline *****/
|
/***** Get list of pubications to show in timeline *****/
|
||||||
Timeline->UsrOrGbl = Tml_Usr_TIMELINE_USR;
|
Timeline->UsrOrGbl = Tml_Usr_TIMELINE_USR;
|
||||||
Timeline->WhatToGet = Tml_GET_RECENT_TIMELINE;
|
Timeline->WhatToGet = Tml_GET_RECENT_PUBS;
|
||||||
Tml_Pub_GetListPubsToShowInTimeline (Timeline);
|
Tml_Pub_GetListPubsToShowInTimeline (Timeline);
|
||||||
|
|
||||||
/***** Show timeline *****/
|
/***** Show timeline *****/
|
||||||
|
@ -310,7 +310,7 @@ void Tml_RefreshNewTimelineGbl (void)
|
||||||
|
|
||||||
/***** Get list of pubications to show in timeline *****/
|
/***** Get list of pubications to show in timeline *****/
|
||||||
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
|
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
|
||||||
Timeline.WhatToGet = Tml_GET_ONLY_NEW_PUBS;
|
Timeline.WhatToGet = Tml_GET_NEW_PUBS;
|
||||||
Tml_Pub_GetListPubsToShowInTimeline (&Timeline);
|
Tml_Pub_GetListPubsToShowInTimeline (&Timeline);
|
||||||
|
|
||||||
/***** Show new timeline *****/
|
/***** Show new timeline *****/
|
||||||
|
@ -336,7 +336,7 @@ void Tml_RefreshOldTimelineGbl (void)
|
||||||
|
|
||||||
/***** Show old publications *****/
|
/***** Show old publications *****/
|
||||||
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
|
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
|
||||||
Timeline.WhatToGet = Tml_GET_ONLY_OLD_PUBS;
|
Timeline.WhatToGet = Tml_GET_OLD_PUBS;
|
||||||
Tml_GetAndShowOldTimeline (&Timeline);
|
Tml_GetAndShowOldTimeline (&Timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ void Tml_RefreshOldTimelineUsr (void)
|
||||||
|
|
||||||
/***** If user exists, show old publications *****/
|
/***** If user exists, show old publications *****/
|
||||||
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_USR;
|
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_USR;
|
||||||
Timeline.WhatToGet = Tml_GET_ONLY_OLD_PUBS;
|
Timeline.WhatToGet = Tml_GET_OLD_PUBS;
|
||||||
Tml_GetAndShowOldTimeline (&Timeline);
|
Tml_GetAndShowOldTimeline (&Timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,12 +69,14 @@ typedef enum
|
||||||
#define Tml_NUM_WHAT_TO_GET 3
|
#define Tml_NUM_WHAT_TO_GET 3
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Tml_GET_RECENT_TIMELINE, // Recent timeline is shown when the user clicks on action menu,...
|
Tml_GET_NEW_PUBS, // New publications are retrieved via AJAX...
|
||||||
// or after editing timeline
|
// automatically from time to time
|
||||||
Tml_GET_ONLY_NEW_PUBS, // New publications are retrieved via AJAX
|
Tml_GET_RECENT_PUBS, // Recent timeline is shown...
|
||||||
// automatically from time to time
|
// when the user clicks on action menu,...
|
||||||
Tml_GET_ONLY_OLD_PUBS, // Old publications are retrieved via AJAX
|
// or after editing timeline
|
||||||
// when the user clicks on link at bottom of timeline
|
Tml_GET_OLD_PUBS, // Old publications are retrieved via AJAX...
|
||||||
|
// when the user clicks on link...
|
||||||
|
// at bottom of timeline
|
||||||
} Tml_WhatToGet_t;
|
} Tml_WhatToGet_t;
|
||||||
|
|
||||||
struct Tml_Timeline
|
struct Tml_Timeline
|
||||||
|
|
|
@ -922,9 +922,9 @@ void Tml_DB_CreateSubQueryAlreadyExists (const struct Tml_Timeline *Timeline,
|
||||||
{
|
{
|
||||||
static const char *Table[Tml_NUM_WHAT_TO_GET] =
|
static const char *Table[Tml_NUM_WHAT_TO_GET] =
|
||||||
{
|
{
|
||||||
[Tml_GET_RECENT_TIMELINE] = "tml_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
[Tml_GET_NEW_PUBS ] = "tml_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
||||||
[Tml_GET_ONLY_NEW_PUBS ] = "tml_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
[Tml_GET_RECENT_PUBS] = "tml_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
||||||
[Tml_GET_ONLY_OLD_PUBS ] = "tml_tmp_visible_timeline", // Avoid notes already shown
|
[Tml_GET_OLD_PUBS ] = "tml_tmp_visible_timeline", // Avoid notes already shown
|
||||||
};
|
};
|
||||||
|
|
||||||
snprintf (SubQueries->AlreadyExists,sizeof (SubQueries->AlreadyExists),
|
snprintf (SubQueries->AlreadyExists,sizeof (SubQueries->AlreadyExists),
|
||||||
|
@ -970,8 +970,8 @@ unsigned Tml_DB_SelectTheMostRecentPub (const struct Tml_Pub_SubQueries *SubQuer
|
||||||
"tml_pubs.PubType" // row[3]
|
"tml_pubs.PubType" // row[3]
|
||||||
" FROM tml_pubs%s"
|
" FROM tml_pubs%s"
|
||||||
" WHERE %s%s%s%s"
|
" WHERE %s%s%s%s"
|
||||||
" ORDER BY tml_pubs.PubCod"
|
" ORDER BY tml_pubs.PubCod DESC"
|
||||||
" DESC LIMIT 1",
|
" LIMIT 1",
|
||||||
SubQueries->TablePublishers,
|
SubQueries->TablePublishers,
|
||||||
SubQueries->RangeBottom,
|
SubQueries->RangeBottom,
|
||||||
SubQueries->RangeTop,
|
SubQueries->RangeTop,
|
||||||
|
@ -1024,28 +1024,18 @@ long Tml_DB_GetNotCodFromPubCod (long PubCod)
|
||||||
|
|
||||||
long Tml_DB_GetPubCodFromSession (const char *FieldName)
|
long Tml_DB_GetPubCodFromSession (const char *FieldName)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
long PubCod;
|
long PubCod;
|
||||||
|
|
||||||
/***** Get last publication code from database *****/
|
/***** Get last publication code from database *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get publication code from session",
|
PubCod = DB_QuerySELECTCode ("can not get publication code from session",
|
||||||
"SELECT %s" // row[0]
|
"SELECT %s" // row[0]
|
||||||
" FROM ses_sessions"
|
" FROM ses_sessions"
|
||||||
" WHERE SessionId='%s'",
|
" WHERE SessionId='%s'",
|
||||||
FieldName,Gbl.Session.Id) == 1)
|
FieldName,
|
||||||
{
|
Gbl.Session.Id);
|
||||||
/* Get last publication code */
|
if (PubCod < 0)
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
if (sscanf (row[0],"%ld",&PubCod) != 1)
|
|
||||||
PubCod = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
PubCod = 0;
|
PubCod = 0;
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
return PubCod;
|
return PubCod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,24 @@ static Tml_Pub_Type_t Tml_Pub_GetPubTypeFromStr (const char *Str);
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************** Get list of pubications to show in timeline *****************/
|
/*************** Get list of pubications to show in timeline *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
|
_ ______________________
|
||||||
|
/ |______________________| Tml_GET_ONLY_NEW_PUBS
|
||||||
|
New < |______________________| automatically from time to time
|
||||||
|
\_|______________________| (AJAX)
|
||||||
|
_|_See_new_activity_(3)_|
|
||||||
|
/ |______________________| Tml_GET_RECENT_TIMELINE
|
||||||
|
| |______________________| user clicks on action menu
|
||||||
|
Recent < |______________________| or after editing timeline
|
||||||
|
| |______________________|
|
||||||
|
\_|______________________|
|
||||||
|
_|_______See_more_______|
|
||||||
|
/ |______________________| Tml_GET_ONLY_OLD_PUBS
|
||||||
|
| |______________________| user clicks on bottom link
|
||||||
|
Old < |______________________| (AJAX)
|
||||||
|
| |______________________|
|
||||||
|
\_|______________________|
|
||||||
|
*/
|
||||||
void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
{
|
{
|
||||||
struct Tml_Pub_SubQueries SubQueries;
|
struct Tml_Pub_SubQueries SubQueries;
|
||||||
|
@ -76,7 +93,7 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
Tml_Pub_InitializeRangeOfPubs (Timeline->WhatToGet,&RangePubsToGet);
|
Tml_Pub_InitializeRangeOfPubs (Timeline->WhatToGet,&RangePubsToGet);
|
||||||
|
|
||||||
/***** Clear timeline for this session in database *****/
|
/***** Clear timeline for this session in database *****/
|
||||||
if (Timeline->WhatToGet == Tml_GET_RECENT_TIMELINE)
|
if (Timeline->WhatToGet == Tml_GET_RECENT_PUBS)
|
||||||
Tml_DB_ClearTimelineNotesOfSessionFromDB ();
|
Tml_DB_ClearTimelineNotesOfSessionFromDB ();
|
||||||
|
|
||||||
/***** Create temporary tables *****/
|
/***** Create temporary tables *****/
|
||||||
|
@ -84,7 +101,7 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
Tml_DB_CreateTmpTableJustRetrievedNotes ();
|
Tml_DB_CreateTmpTableJustRetrievedNotes ();
|
||||||
|
|
||||||
/* Create temporary table with all notes visible in timeline */
|
/* Create temporary table with all notes visible in timeline */
|
||||||
if (Timeline->WhatToGet == Tml_GET_ONLY_OLD_PUBS)
|
if (Timeline->WhatToGet == Tml_GET_OLD_PUBS)
|
||||||
Tml_DB_CreateTmpTableVisibleTimeline ();
|
Tml_DB_CreateTmpTableVisibleTimeline ();
|
||||||
|
|
||||||
/***** Create subqueries *****/
|
/***** Create subqueries *****/
|
||||||
|
@ -120,15 +137,16 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
|
|
||||||
/***** Get the publications in timeline *****/
|
/***** Get the publications in timeline *****/
|
||||||
/* With the current approach, we select one by one
|
/* With the current approach, we select one by one
|
||||||
the publications and notes in a loop. In each iteration,
|
the publications and notes in a loop.
|
||||||
we get the most recent publication (original, shared or commment)
|
In each iteration:
|
||||||
of every set of publications corresponding to the same note,
|
we get the most recent publication (original, shared or comment)
|
||||||
checking that the note is not already retrieved.
|
of every set of publications corresponding to the same note,
|
||||||
After getting a publication, its note code is stored
|
checking that the note is not already retrieved.
|
||||||
in order to not get it again.
|
After getting a publication, its note code is saved
|
||||||
|
in order to not get it again.
|
||||||
|
|
||||||
As an alternative, we tried to get the maximum PubCod,
|
As an alternative, we tried to get the maximum PubCod,
|
||||||
i.e more recent publication (original, shared or commment),
|
i.e more recent publication (original, shared or comment),
|
||||||
of every set of publications corresponding to the same note:
|
of every set of publications corresponding to the same note:
|
||||||
SELECT MAX(PubCod) AS NewestPubCod
|
SELECT MAX(PubCod) AS NewestPubCod
|
||||||
FROM tml_pubs ...
|
FROM tml_pubs ...
|
||||||
|
@ -152,7 +170,7 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
Timeline->Pubs.Top = Pub; // Pointer to top publication
|
Timeline->Pubs.Top = Pub; // Pointer to top publication
|
||||||
else
|
else
|
||||||
Timeline->Pubs.Bottom->Next = Pub; // Chain the previous publication with the current one
|
Timeline->Pubs.Bottom->Next = Pub; // Chain the previous publication with the current one
|
||||||
Timeline->Pubs.Bottom = Pub; // Update pointer to bottom publication
|
Timeline->Pubs.Bottom = Pub; // Update pointer to bottom publication
|
||||||
|
|
||||||
if (Pub == NULL) // Nothing got ==> abort loop
|
if (Pub == NULL) // Nothing got ==> abort loop
|
||||||
break; // Last publication
|
break; // Last publication
|
||||||
|
@ -160,7 +178,7 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
/* Insert note in temporary tables with just retrieved notes.
|
/* Insert note in temporary tables with just retrieved notes.
|
||||||
These tables will be used to not get notes already shown */
|
These tables will be used to not get notes already shown */
|
||||||
Tml_DB_InsertNoteInJustRetrievedNotes (Pub->NotCod);
|
Tml_DB_InsertNoteInJustRetrievedNotes (Pub->NotCod);
|
||||||
if (Timeline->WhatToGet == Tml_GET_ONLY_OLD_PUBS) // Get only old publications
|
if (Timeline->WhatToGet == Tml_GET_OLD_PUBS) // Get only old publications
|
||||||
Tml_DB_InsertNoteInVisibleTimeline (Pub->NotCod);
|
Tml_DB_InsertNoteInVisibleTimeline (Pub->NotCod);
|
||||||
|
|
||||||
/* Narrow the range for the next iteration */
|
/* Narrow the range for the next iteration */
|
||||||
|
@ -177,7 +195,7 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
/***** Drop temporary tables *****/
|
/***** Drop temporary tables *****/
|
||||||
/* Drop temporary tables with notes already retrieved */
|
/* Drop temporary tables with notes already retrieved */
|
||||||
Tml_DB_DropTmpTableJustRetrievedNotes ();
|
Tml_DB_DropTmpTableJustRetrievedNotes ();
|
||||||
if (Timeline->WhatToGet == Tml_GET_ONLY_OLD_PUBS) // Get only old publications
|
if (Timeline->WhatToGet == Tml_GET_OLD_PUBS) // Get only old publications
|
||||||
Tml_DB_DropTmpTableVisibleTimeline ();
|
Tml_DB_DropTmpTableVisibleTimeline ();
|
||||||
|
|
||||||
/* Drop temporary table with me and users I follow */
|
/* Drop temporary table with me and users I follow */
|
||||||
|
@ -210,28 +228,31 @@ static void Tml_Pub_InitializeRangeOfPubs (Tml_WhatToGet_t WhatToGet,
|
||||||
|_____| 1
|
|_____| 1
|
||||||
0
|
0
|
||||||
*/
|
*/
|
||||||
/* Default range */
|
|
||||||
RangePubsToGet->Top = 0; // +Infinite
|
|
||||||
RangePubsToGet->Bottom = 0; // -Infinite
|
|
||||||
|
|
||||||
switch (WhatToGet)
|
switch (WhatToGet)
|
||||||
{
|
{
|
||||||
case Tml_GET_ONLY_NEW_PUBS: // Get the publications (without limit)
|
case Tml_GET_NEW_PUBS: // Get the publications (without limit)
|
||||||
// newer than LastPubCod
|
// newer than LastPubCod
|
||||||
/* This query is made via AJAX automatically from time to time */
|
/* This query is made via AJAX automatically from time to time */
|
||||||
|
RangePubsToGet->Top = 0; // +Infinite
|
||||||
RangePubsToGet->Bottom = Tml_DB_GetPubCodFromSession ("LastPubCod");
|
RangePubsToGet->Bottom = Tml_DB_GetPubCodFromSession ("LastPubCod");
|
||||||
break;
|
break;
|
||||||
case Tml_GET_ONLY_OLD_PUBS: // Get some limited publications
|
case Tml_GET_RECENT_PUBS: // Get some limited recent publications
|
||||||
// older than FirstPubCod
|
/* This is the first query to get initial timeline shown
|
||||||
|
==> no notes yet in current timeline table */
|
||||||
|
RangePubsToGet->Top = 0; // +Infinite
|
||||||
|
RangePubsToGet->Bottom = 0; // -Infinite
|
||||||
|
break;
|
||||||
|
case Tml_GET_OLD_PUBS: // Get some limited publications
|
||||||
|
// older than FirstPubCod
|
||||||
/* This query is made via AJAX
|
/* This query is made via AJAX
|
||||||
when I click in link to get old publications */
|
when I click in link to get old publications */
|
||||||
RangePubsToGet->Top = Tml_DB_GetPubCodFromSession ("FirstPubCod");
|
RangePubsToGet->Top = Tml_DB_GetPubCodFromSession ("FirstPubCod");
|
||||||
|
RangePubsToGet->Bottom = 0; // -Infinite
|
||||||
break;
|
break;
|
||||||
case Tml_GET_RECENT_TIMELINE: // Get some limited recent publications
|
|
||||||
default:
|
default:
|
||||||
/* This is the first query to get initial timeline shown
|
RangePubsToGet->Top = 0; // +Infinite
|
||||||
==> no notes yet in current timeline table */
|
RangePubsToGet->Bottom = 0; // -Infinite
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,9 +264,9 @@ static unsigned Tml_Pub_GetMaxPubsToGet (const struct Tml_Timeline *Timeline)
|
||||||
{
|
{
|
||||||
static const unsigned MaxPubsToGet[Tml_NUM_WHAT_TO_GET] =
|
static const unsigned MaxPubsToGet[Tml_NUM_WHAT_TO_GET] =
|
||||||
{
|
{
|
||||||
[Tml_GET_RECENT_TIMELINE] = Tml_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW,
|
[Tml_GET_NEW_PUBS ] = Tml_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW,
|
||||||
[Tml_GET_ONLY_NEW_PUBS ] = Tml_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW,
|
[Tml_GET_RECENT_PUBS] = Tml_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW,
|
||||||
[Tml_GET_ONLY_OLD_PUBS ] = Tml_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW,
|
[Tml_GET_OLD_PUBS ] = Tml_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW,
|
||||||
};
|
};
|
||||||
|
|
||||||
return MaxPubsToGet[Timeline->WhatToGet];
|
return MaxPubsToGet[Timeline->WhatToGet];
|
||||||
|
@ -262,18 +283,18 @@ static void Tml_Pub_UpdateFirstLastPubCodesIntoSession (const struct Tml_Timelin
|
||||||
|
|
||||||
switch (Timeline->WhatToGet)
|
switch (Timeline->WhatToGet)
|
||||||
{
|
{
|
||||||
case Tml_GET_ONLY_NEW_PUBS: // Get only new publications
|
case Tml_GET_NEW_PUBS: // Get only new publications
|
||||||
Tml_DB_UpdateLastPubCodInSession ();
|
Tml_DB_UpdateLastPubCodInSession ();
|
||||||
break;
|
break;
|
||||||
case Tml_GET_ONLY_OLD_PUBS: // Get only old publications
|
case Tml_GET_RECENT_PUBS: // Get last publications
|
||||||
case Tml_GET_RECENT_TIMELINE: // Get last publications
|
case Tml_GET_OLD_PUBS: // Get only old publications
|
||||||
// The oldest publication code retrieved and shown
|
// The oldest publication code retrieved and shown
|
||||||
FirstPubCod = Timeline->Pubs.Bottom ? Timeline->Pubs.Bottom->PubCod :
|
FirstPubCod = Timeline->Pubs.Bottom ? Timeline->Pubs.Bottom->PubCod :
|
||||||
0;
|
0;
|
||||||
if (Timeline->WhatToGet == Tml_GET_ONLY_OLD_PUBS)
|
if (Timeline->WhatToGet == Tml_GET_RECENT_PUBS)
|
||||||
Tml_DB_UpdateFirstPubCodInSession (FirstPubCod);
|
|
||||||
else
|
|
||||||
Tml_DB_UpdateFirstLastPubCodsInSession (FirstPubCod);
|
Tml_DB_UpdateFirstLastPubCodsInSession (FirstPubCod);
|
||||||
|
else
|
||||||
|
Tml_DB_UpdateFirstPubCodInSession (FirstPubCod);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
// Number of recent publishings got and shown the first time, before refreshing
|
// Number of recent publishings got and shown the first time, before refreshing
|
||||||
#define Tml_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW 10 // Recent publishings to show (first time)
|
|
||||||
#define Tml_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW 10000 // New publishings retrieved (big number)
|
#define Tml_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW 10000 // New publishings retrieved (big number)
|
||||||
|
#define Tml_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW 10 // Recent publishings to show (first time)
|
||||||
#define Tml_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW 20 // Old publishings are retrieved in packs of this size
|
#define Tml_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW 20 // Old publishings are retrieved in packs of this size
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Tml_Usr_TIMELINE_USR, // Show the timeline of a user
|
Tml_Usr_TIMELINE_USR, // Show the timeline of a user
|
||||||
Tml_Usr_TIMELINE_GBL, // Show the timeline of the users follwed by me
|
Tml_Usr_TIMELINE_GBL, // Show the timeline of the users follwed by me
|
||||||
} Tml_Usr_UsrOrGbl_t;
|
} Tml_Usr_UsrOrGbl_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
Loading…
Reference in New Issue