Version 22.78.14: Mar 23, 2023 Code refactoring in timeline.

This commit is contained in:
acanas 2023-03-23 19:56:18 +01:00
parent 54bec4644d
commit 21e670b8e5
32 changed files with 74 additions and 81 deletions

View File

@ -195,7 +195,7 @@ static void Ann_GetAnnouncementDataFromRow (MYSQL_RES *mysql_res,
MYSQL_ROW row;
unsigned UnsignedNum;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get announcement code (row[0]) *****/

View File

@ -886,7 +886,7 @@ static void Asg_GetAssignmentDataFromRow (MYSQL_RES **mysql_res,
/***** Get data of assignment from database *****/
if (NumAsgs) // Assignment found...
{
/* Get row */
/* Get next row from result */
row = mysql_fetch_row (*mysql_res);
/*
row[0] AsgCod

View File

@ -743,7 +743,7 @@ bool Att_GetEventDataByCod (struct Att_Event *Event)
/***** Get data of attendance event from database *****/
if ((Found = (NumAttEvents != 0))) // Attendance event found...
{
/* Get row */
/* Get next row from result */
row = mysql_fetch_row (mysql_res);
/* Get attendance event (except Txt) */

View File

@ -341,7 +341,7 @@ static void Ban_GetBannerDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get banner code (row[0]) *****/

View File

@ -8487,7 +8487,7 @@ static void Brw_GetFileMetadataFromRow (MYSQL_RES *mysql_res,
MYSQL_ROW row;
unsigned UnsignedNum;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get file code (row[0]) *****/

View File

@ -373,7 +373,7 @@ static void Bld_GetBuildingDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get building code (row[0]) *****/

View File

@ -536,7 +536,7 @@ void Ctr_GetBasicListOfCenters (long InsCod)
NumCtr++)
/* Get center data */
Ctr_GetCenterDataFromRow (mysql_res,&(Gbl.Hierarchy.Ctrs.Lst[NumCtr]),
false); // Don't get number of users who claim to belong to this center
false); // Don't get number of users who claim to belong to this center
}
/***** Free structure that stores the query result *****/
@ -626,7 +626,7 @@ static void Ctr_GetCenterDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get center code (row[0]) *****/

View File

@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
*/
#define Log_PLATFORM_VERSION "SWAD 22.78.13 (2023-03-23)"
#define Log_PLATFORM_VERSION "SWAD 22.78.14 (2023-03-23)"
#define CSS_FILE "swad22.57.1.css"
#define JS_FILE "swad22.49.js"
/*
Version 22.78.14: Mar 23, 2023 Code refactoring in timeline. (337635 lines)
Version 22.78.13: Mar 23, 2023 Code refactoring in rooms. (337641 lines)
Version 22.78.12: Mar 23, 2023 Code refactoring in plugins. (337651 lines)
Version 22.78.11: Mar 23, 2023 Code refactoring in places. (337652 lines)

View File

@ -1652,7 +1652,7 @@ static void Crs_GetCourseDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get course code (row[0]) *****/

View File

@ -1205,7 +1205,7 @@ static void Deg_GetDegreeDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/**** Get row ****/
/**** Get next row from result ****/
row = mysql_fetch_row (mysql_res);
/***** Get degree code (row[0]) *****/

View File

@ -411,7 +411,7 @@ static void Dpt_GetDepartmentDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get department code (row[0]) *****/

View File

@ -275,6 +275,7 @@ static void ExaPrn_GetPrintDataFromRow (MYSQL_RES **mysql_res,
if (NumPrints)
{
/* Get next row from result */
row = mysql_fetch_row (*mysql_res);
/* Get print code (row[0]) */

View File

@ -733,7 +733,7 @@ static void ExaSes_GetSessionDataFromRow (MYSQL_RES *mysql_res,
MYSQL_ROW row;
Dat_StartEndTime_t StartEndTime;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[0] SesCod

View File

@ -816,7 +816,7 @@ void ExaSet_GetSetDataFromRow (MYSQL_RES *mysql_res,struct ExaSet_Set *Set)
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[0] SetCod

View File

@ -380,7 +380,7 @@ static void Hld_GetHolidayDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[0]: HldCod

View File

@ -732,7 +732,7 @@ static void Ins_GetInstitDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[0]: InsCod

View File

@ -360,7 +360,7 @@ static void Lnk_GetLinkDataFromRow (MYSQL_RES *mysql_res,struct Lnk_Link *Lnk)
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[0] LnkCod

View File

@ -403,7 +403,7 @@ static void Mai_GetMailDomainDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get mail code (row[0]) *****/

View File

@ -884,7 +884,7 @@ static void Mch_GetMatchDataFromRow (MYSQL_RES *mysql_res,
Dat_StartEndTime_t StartEndTime;
long LongNum;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[ 0] MchCod

View File

@ -477,7 +477,7 @@ static void Not_GetNoticeDataFromRow (MYSQL_RES *mysql_res,
MYSQL_ROW row;
unsigned UnsignedNum;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get notice code (row[0]) *****/

View File

@ -419,7 +419,7 @@ static void Plc_GetPlaceDataFromRow (MYSQL_RES *mysql_res,struct Plc_Place *Plc)
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get place code (row[0]) *****/

View File

@ -304,7 +304,7 @@ static void Plg_GetPluginDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get plugin code (row[0]) *****/

View File

@ -573,13 +573,9 @@ void Rub_GetRubricDataByCod (struct Rub_Rubric *Rubric)
/* Get row */
row = mysql_fetch_row (mysql_res);
/* Get code of the rubric (row[0]) */
/* Get code of the rubric (row[0]), course (row[1] and author (row[2]) */
Rubric->RubCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get code of the course (row[1]) */
Rubric->CrsCod = Str_ConvertStrCodToLongCod (row[1]);
/* Get author of the rubric (row[2]) */
Rubric->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
/* Get the title of the rubric (row[3]) */

View File

@ -701,7 +701,7 @@ static void RubCri_GetCriterionDataFromRow (MYSQL_RES *mysql_res,
MYSQL_ROW row;
RubCri_ValueRange_t ValueRange;
/* Get row */
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[0] CriCod
@ -714,29 +714,27 @@ static void RubCri_GetCriterionDataFromRow (MYSQL_RES *mysql_res,
row[7] Weight
row[8] Title
*/
/* Get criterion code (row[0]) */
/***** Get criterion code (row[0]) and rubric code (row[1]) *****/
Criterion->CriCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get rubric code (row[0]) */
Criterion->RubCod = Str_ConvertStrCodToLongCod (row[1]);
/* Get criterion index (row[2]) */
/***** Get criterion index (row[2]) *****/
Criterion->CriInd = Str_ConvertStrToUnsigned (row[2]);
/* Get source (row[3]) and code (row[4]) */
/***** Get source (row[3]) and code (row[4]) *****/
Criterion->Source = RubCri_GetSourceFromDBStr (row[3]);
Criterion->Cod = Str_ConvertStrCodToLongCod (row[4]);
/* Get criterion minimum and maximum values (row[5], row[6]) */
/***** Get criterion minimum and maximum values (row[5], row[6]) *****/
for (ValueRange = (RubCri_ValueRange_t) 0;
ValueRange <= (RubCri_ValueRange_t) (RubCri_NUM_VALUES - 1);
ValueRange++)
Criterion->Values[ValueRange] = Str_GetDoubleFromStr (row[5 + ValueRange]);
/* Get criterion weight (row[7]) */
/***** Get criterion weight (row[7]) *****/
Criterion->Weight = Str_GetDoubleFromStr (row[5 + RubCri_NUM_VALUES]);
/* Get the title of the criterion (row[8]) */
/***** Get the title of the criterion (row[8]) *****/
Str_Copy (Criterion->Title,row[5 + RubCri_NUM_VALUES + 1],sizeof (Criterion->Title) - 1);
}

View File

@ -2845,7 +2845,7 @@ static void Svy_GetQstDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get the code of the question (row[0]) *****/

View File

@ -338,7 +338,7 @@ static void TstCfg_GetConfigDataFromRow (MYSQL_RES *mysql_res)
long LongNum;
TstCfg_Pluggable_t Pluggable;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get whether test are visible via plugins or not *****/

View File

@ -164,6 +164,10 @@ static unsigned Tml_ListRecentPubs (const struct Tml_Timeline *Timeline,
static void Tml_PutHiddenList (const char *Id);
static void Tml_GetNumNotesAndUsrsFromRow (MYSQL_RES *mysql_res,
unsigned *NumNotes,
unsigned *NumUsrs);
/*****************************************************************************/
/************************ Initialize global timeline *************************/
/*****************************************************************************/
@ -588,24 +592,9 @@ void Tml_GetAndShowTimelineActivityStats (void)
{
/***** Get number of timeline notes and users for this type *****/
if (Tml_DB_GetNumNotesAndUsrsByType (&mysql_res,NoteType))
{
row = mysql_fetch_row (mysql_res);
/* Get number of timeline notes */
if (row[0])
if (sscanf (row[0],"%u",&NumNotes) != 1)
NumNotes = 0;
/* Get number of users */
if (row[1])
if (sscanf (row[1],"%u",&NumUsrs) != 1)
NumUsrs = 0;
}
Tml_GetNumNotesAndUsrsFromRow (mysql_res,&NumNotes,&NumUsrs);
else
{
NumNotes = 0;
NumUsrs = 0;
}
NumNotes = NumUsrs = 0;
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
@ -642,25 +631,9 @@ void Tml_GetAndShowTimelineActivityStats (void)
/***** Get and write totals *****/
if (Tml_DB_GetNumNotesAndUsrsTotal (&mysql_res))
{
/* Get number of social notes and number of users */
row = mysql_fetch_row (mysql_res);
/* Get number of social notes */
if (row[0])
if (sscanf (row[0],"%u",&NumNotes) != 1)
NumNotes = 0;
/* Get number of users */
if (row[1])
if (sscanf (row[1],"%u",&NumUsrs) != 1)
NumUsrs = 0;
}
Tml_GetNumNotesAndUsrsFromRow (mysql_res,&NumNotes,&NumUsrs);
else
{
NumNotes = 0;
NumUsrs = 0;
}
NumNotes = NumUsrs = 0;
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
@ -701,3 +674,27 @@ void Tml_GetAndShowTimelineActivityStats (void)
/***** End table and box *****/
Box_BoxTableEnd ();
}
/*****************************************************************************/
/************** Get number of notes and users from database row **************/
/*****************************************************************************/
static void Tml_GetNumNotesAndUsrsFromRow (MYSQL_RES *mysql_res,
unsigned *NumNotes,
unsigned *NumUsrs)
{
MYSQL_ROW row;
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/***** Get number of notes *****/
if (row[0])
if (sscanf (row[0],"%u",NumNotes) != 1)
*NumNotes = 0;
/***** Get number of users *****/
if (row[1])
if (sscanf (row[1],"%u",NumUsrs) != 1)
*NumUsrs = 0;
}

View File

@ -1072,7 +1072,7 @@ static void TmlCom_GetCommDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[0]: PubCod

View File

@ -1201,7 +1201,7 @@ static void TmlNot_GetNoteDataFromRow (MYSQL_RES *mysql_res,
{
MYSQL_ROW row;
/***** Get row *****/
/***** Get next row from result *****/
row = mysql_fetch_row (mysql_res);
/*
row[0]: NotCod

View File

@ -108,7 +108,7 @@ void TmlNtf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
/***** Get summary and content from post from database *****/
if (Tml_DB_GetPubDataByCod (PubCod,&mysql_res) == 1) // Result should have a unique row
/* Get data of publication from row */
TmlPub_GetPubDataFromNextRow (mysql_res,&Pub);
TmlPub_GetPubDataFromRow (mysql_res,&Pub);
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);

View File

@ -361,7 +361,7 @@ static struct TmlPub_Publication *TmlPub_SelectTheMostRecentPub (const struct Tm
Err_NotEnoughMemoryExit ();
/* Get data of publication */
TmlPub_GetPubDataFromNextRow (mysql_res,Pub);
TmlPub_GetPubDataFromRow (mysql_res,Pub);
Pub->Next = NULL;
}
else
@ -510,8 +510,8 @@ void TmlPub_PutLinkToViewOldPubs (void)
/***************** Get data of publication using its code ********************/
/*****************************************************************************/
void TmlPub_GetPubDataFromNextRow (MYSQL_RES *mysql_res,
struct TmlPub_Publication *Pub)
void TmlPub_GetPubDataFromRow (MYSQL_RES *mysql_res,
struct TmlPub_Publication *Pub)
{
MYSQL_ROW row;

View File

@ -115,8 +115,8 @@ Tml_TopMessage_t TmlPub_GetTopMessage (TmlPub_Type_t PubType);
void TmlPub_PutLinkToViewNewPubs (void);
void TmlPub_PutLinkToViewOldPubs (void);
void TmlPub_GetPubDataFromNextRow (MYSQL_RES *mysql_res,
struct TmlPub_Publication *Pub);
void TmlPub_GetPubDataFromRow (MYSQL_RES *mysql_res,
struct TmlPub_Publication *Pub);
void TmlPub_PublishPubInTimeline (struct TmlPub_Publication *Pub);