Version19.112.21

This commit is contained in:
Antonio Cañas Vargas 2020-01-07 16:08:13 +01:00
parent d197a9428d
commit f30375e7ce
7 changed files with 34 additions and 15 deletions

View File

@ -492,7 +492,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.112.20 (2020-01-07)"
#define Log_PLATFORM_VERSION "SWAD 19.112.21 (2020-01-07)"
#define CSS_FILE "swad19.112.css"
#define JS_FILE "swad19.91.1.js"
/*
@ -502,6 +502,7 @@ ps2pdf source.ps destination.pdf
// TODO: Mapas más estrechos en móvil
// TODO: Quitar todos los EXTRA_DATA.
Version 19.112.21:Jan 07, 2020 Optimization in number of degrees in a country. (278741 lines)
Version 19.112.20:Jan 07, 2020 Optimization in number of courses in a country. (278724 lines)
Version 19.112.19:Jan 07, 2020 Optimization in number of users in a country. (278675 lines)
Version 19.112.18:Jan 07, 2020 Optimization in number of users in a country. (278668 lines)

View File

@ -428,7 +428,7 @@ static void Cty_ListOneCountryForSeeing (struct Country *Cty,unsigned NumCty)
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM %s\"",BgColor);
HTM_Unsigned (Cty->NumDegs);
HTM_Unsigned (Deg_GetNumDegsInCty (Cty->CtyCod));
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM %s\"",BgColor);
@ -844,7 +844,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
Cty->WWW[Lan][0] = '\0';
}
Cty->NumUsrsWhoClaimToBelongToCty.Valid = false;
Cty->Inss.Num = Cty->NumCtrs = Cty->NumDegs = 0;
Cty->Inss.Num = Cty->NumCtrs = 0;
/* Get the name of the country in current language */
Str_Copy (Cty->Name[Gbl.Prefs.Language],row[2],
@ -871,9 +871,6 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData)
/* Get number of centres in this country */
Cty->NumCtrs = Ctr_GetNumCtrsInCty (Cty->CtyCod);
/* Get number of degrees in this country */
Cty->NumDegs = Deg_GetNumDegsInCty (Cty->CtyCod);
break;
}
}
@ -1001,7 +998,7 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD
Cty->WWW[Lan][0] = '\0';
}
Cty->NumUsrsWhoClaimToBelongToCty.Valid = false;
Cty->Inss.Num = Cty->NumCtrs = Cty->NumDegs = 0;
Cty->Inss.Num = Cty->NumCtrs = 0;
/***** Check if country code is correct *****/
if (Cty->CtyCod == 0)
@ -1376,6 +1373,7 @@ void Cty_RemoveCountry (void)
/***** Flush cache *****/
Cty_FlushCacheCountryName ();
Ins_FlushCacheNumInssInCty ();
Deg_FlushCacheNumDegsInCty ();
Crs_FlushCacheNumCrssInCty ();
Usr_FlushCacheNumUsrsWhoClaimToBelongToCty ();
@ -2080,7 +2078,6 @@ static void Cty_EditingCountryConstructor (void)
Cty_EditingCty->Inss.Lst = NULL;
Cty_EditingCty->Inss.SelectedOrder = Ins_ORDER_DEFAULT;
Cty_EditingCty->NumCtrs = 0;
Cty_EditingCty->NumDegs = 0;
Cty_EditingCty->NumUsrsWhoClaimToBelongToCty.Valid = false;
}

View File

@ -58,8 +58,6 @@ struct Country
Ins_Order_t SelectedOrder;
} Inss;
unsigned NumCtrs;
unsigned NumDegs;
// unsigned NumCrss;
struct
{
bool Valid;

View File

@ -1860,16 +1860,32 @@ unsigned Deg_GetNumDegsTotal (void)
/********************* Get number of degrees in a country ********************/
/*****************************************************************************/
unsigned Deg_GetNumDegsInCty (long InsCod)
void Deg_FlushCacheNumDegsInCty (void)
{
/***** Get number of degrees in a country from database *****/
return
Gbl.Cache.NumDegsInCty.CtyCod = -1L;
Gbl.Cache.NumDegsInCty.NumDegs = 0;
}
unsigned Deg_GetNumDegsInCty (long CtyCod)
{
/***** 1. Fast check: Trivial case *****/
if (CtyCod <= 0)
return 0;
/***** 2. Fast check: If cached... *****/
if (CtyCod == Gbl.Cache.NumDegsInCty.CtyCod)
return Gbl.Cache.NumDegsInCty.NumDegs;
/***** 3. Slow: number of degrees in a country from database *****/
Gbl.Cache.NumDegsInCty.CtyCod = CtyCod;
Gbl.Cache.NumDegsInCty.NumDegs =
(unsigned) DB_QueryCOUNT ("can not get the number of degrees in a country",
"SELECT COUNT(*) FROM institutions,centres,degrees"
" WHERE institutions.CtyCod=%ld"
" AND institutions.InsCod=centres.InsCod"
" AND centres.CtrCod=degrees.CtrCod",
InsCod);
CtyCod);
return Gbl.Cache.NumDegsInCty.NumDegs;
}
/*****************************************************************************/

View File

@ -140,7 +140,8 @@ void Deg_ReceiveLogo (void);
void Deg_RemoveLogo (void);
unsigned Deg_GetNumDegsTotal (void);
unsigned Deg_GetNumDegsInCty (long InsCod);
void Deg_FlushCacheNumDegsInCty (void);
unsigned Deg_GetNumDegsInCty (long CtyCod);
void Deg_FlushCacheNumDegsInIns (void);
unsigned Deg_GetNumDegsInIns (long InsCod);
void Deg_FlushCacheNumDegsInCtr (void);

View File

@ -408,6 +408,7 @@ void Gbl_InitializeGlobals (void)
Ins_FlushCacheFullNameAndCtyOfInstitution ();
Ins_FlushCacheNumInssInCty ();
Deg_FlushCacheNumDegsInCty ();
Crs_FlushCacheNumCrssInCty ();
Dpt_FlushCacheNumDptsInIns ();

View File

@ -788,6 +788,11 @@ struct Globals
long InsCod;
unsigned NumCtrs;
} NumCtrsInIns;
struct
{
long CtyCod;
unsigned NumDegs;
} NumDegsInCty;
struct
{
long InsCod;