mirror of https://github.com/acanas/swad-core.git
Version 20.36.19: Feb 27, 2021 Queries moved to module swad_timeline_database.
This commit is contained in:
parent
e4933ff892
commit
77ac719879
|
@ -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.18 (2021-02-27)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.36.19 (2021-02-27)"
|
||||
#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.19: Feb 27, 2021 Queries moved to module swad_timeline_database. (305363 lines)
|
||||
Version 20.36.18: Feb 27, 2021 Function moved to module swad_timeline_database. (305334 lines)
|
||||
Version 20.36.17: Feb 27, 2021 Query moved to module swad_timeline_database. (305328 lines)
|
||||
Version 20.36.16: Feb 27, 2021 Query moved to module swad_timeline_database. (305317 lines)
|
||||
|
|
|
@ -623,3 +623,51 @@ long TL_DB_GetPubCodFromSession (const char *FieldName,
|
|||
|
||||
return PubCod;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Update first publication code stored in session **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod,
|
||||
const char SessionId[Cns_BYTES_SESSION_ID + 1])
|
||||
{
|
||||
DB_QueryUPDATE ("can not update first publication code into session",
|
||||
"UPDATE sessions"
|
||||
" SET FirstPubCod=%ld"
|
||||
" WHERE SessionId='%s'",
|
||||
FirstPubCod,
|
||||
SessionId);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Update last publication code stored in session **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TL_DB_UpdateLastPubCodInSession (const char SessionId[Cns_BYTES_SESSION_ID + 1])
|
||||
{
|
||||
DB_QueryUPDATE ("can not update last publication code into session",
|
||||
"UPDATE sessions"
|
||||
" SET LastPubCod="
|
||||
"(SELECT IFNULL(MAX(PubCod),0)"
|
||||
" FROM tl_pubs)" // The most recent publication
|
||||
" WHERE SessionId='%s'",
|
||||
SessionId);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Update first and last publication codes stored in session *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod,
|
||||
const char SessionId[Cns_BYTES_SESSION_ID + 1])
|
||||
{
|
||||
DB_QueryUPDATE ("can not update first/last publication codes into session",
|
||||
"UPDATE sessions"
|
||||
" SET FirstPubCod=%ld,"
|
||||
"LastPubCod="
|
||||
"(SELECT IFNULL(MAX(PubCod),0)"
|
||||
" FROM tl_pubs)" // The most recent publication
|
||||
" WHERE SessionId='%s'",
|
||||
FirstPubCod,
|
||||
SessionId);
|
||||
}
|
||||
|
|
|
@ -93,5 +93,10 @@ void TL_DB_RemoveCommentPub (long PubCod,long PublisherCod);
|
|||
/* Publications */
|
||||
long TL_DB_GetPubCodFromSession (const char *FieldName,
|
||||
const char SessionId[Cns_BYTES_SESSION_ID + 1]);
|
||||
void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod,
|
||||
const char SessionId[Cns_BYTES_SESSION_ID + 1]);
|
||||
void TL_DB_UpdateLastPubCodInSession (const char SessionId[Cns_BYTES_SESSION_ID + 1]);
|
||||
void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod,
|
||||
const char SessionId[Cns_BYTES_SESSION_ID + 1]);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -373,41 +373,20 @@ static void TL_Pub_UpdateFirstLastPubCodesIntoSession (const struct TL_Timeline
|
|||
|
||||
switch (Timeline->WhatToGet)
|
||||
{
|
||||
case TL_GET_ONLY_NEW_PUBS:
|
||||
DB_QueryUPDATE ("can not update first/last publication codes into session",
|
||||
"UPDATE sessions"
|
||||
" SET LastPubCod="
|
||||
"(SELECT IFNULL(MAX(PubCod),0)"
|
||||
" FROM tl_pubs)" // The most recent publication
|
||||
" WHERE SessionId='%s'",
|
||||
Gbl.Session.Id);
|
||||
case TL_GET_ONLY_NEW_PUBS: // Get only new publications
|
||||
TL_DB_UpdateLastPubCodInSession (Gbl.Session.Id);
|
||||
break;
|
||||
case TL_GET_ONLY_OLD_PUBS: // Get only old publications
|
||||
// The oldest publication code retrieved and shown
|
||||
FirstPubCod = Timeline->Pubs.Bottom ? Timeline->Pubs.Bottom->PubCod :
|
||||
0;
|
||||
|
||||
DB_QueryUPDATE ("can not update first/last publication codes into session",
|
||||
"UPDATE sessions"
|
||||
" SET FirstPubCod=%ld"
|
||||
" WHERE SessionId='%s'",
|
||||
FirstPubCod,
|
||||
Gbl.Session.Id);
|
||||
TL_DB_UpdateFirstPubCodInSession (FirstPubCod,Gbl.Session.Id);
|
||||
break;
|
||||
case TL_GET_RECENT_TIMELINE:
|
||||
case TL_GET_RECENT_TIMELINE: // Get last publications
|
||||
// The oldest publication code retrieved and shown
|
||||
FirstPubCod = Timeline->Pubs.Bottom ? Timeline->Pubs.Bottom->PubCod :
|
||||
0;
|
||||
|
||||
DB_QueryUPDATE ("can not update first/last publication codes into session",
|
||||
"UPDATE sessions"
|
||||
" SET FirstPubCod=%ld,"
|
||||
"LastPubCod="
|
||||
"(SELECT IFNULL(MAX(PubCod),0)"
|
||||
" FROM tl_pubs)" // The most recent publication
|
||||
" WHERE SessionId='%s'",
|
||||
FirstPubCod,
|
||||
Gbl.Session.Id);
|
||||
TL_DB_UpdateFirstLastPubCodsInSession (FirstPubCod,Gbl.Session.Id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue