From d6206198baad9187fe744b011a8c313d2288dd0b Mon Sep 17 00:00:00 2001 From: acanas Date: Fri, 1 May 2020 23:36:30 +0200 Subject: [PATCH] Version19.209.3 --- swad_changelog.h | 7 ++++++- swad_figure.c | 11 ++++++++++- swad_figure_cache.c | 7 ++++--- swad_figure_cache.h | 17 +++++++++-------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 52ca50c22..328546f24 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -544,10 +544,15 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.209.1 (2020-05-01)" +#define Log_PLATFORM_VERSION "SWAD 19.209.3 (2020-05-01)" #define CSS_FILE "swad19.193.1.css" #define JS_FILE "swad19.193.1.js" /* + Version 19.209.3: May 01, 2020 More figures cached. (300750 lines) + 1 change necessary in database: +DELETE FROM figures; + + Version 19.209.2: May 01, 2020 Fixed bug in figures cached. (300737 lines) Version 19.209.1: May 01, 2020 Fixed bug in figures cached. (? lines) Version 19.209: May 01, 2020 More figures cached. (300734 lines) 3 changes necessary in database: diff --git a/swad_figure.c b/swad_figure.c index 0175f0684..eb61f040c 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -540,6 +540,7 @@ static void Fig_GetAndShowNumUsrsInCrss (Rol_Role_t Role) static void Fig_GetAndShowNumUsrsNotBelongingToAnyCrs (void) { extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; + unsigned NumGsts; char *Class = "DAT RB"; /***** Write the total number of users not belonging to any course *****/ @@ -550,7 +551,15 @@ static void Fig_GetAndShowNumUsrsNotBelongingToAnyCrs (void) HTM_TD_End (); HTM_TD_Begin ("class=\"%s\"",Class); - HTM_Unsigned (Usr_GetNumUsrsNotBelongingToAnyCrs ()); + if (!FigCch_GetFigureFromCache (FigCch_NUM_GSTS,Hie_SYS,-1L, + FigCch_Type_UNSIGNED,&NumGsts)) + { + // Not updated recently in cache ==> compute and update it in cache + NumGsts = Usr_GetNumUsrsNotBelongingToAnyCrs (); + FigCch_UpdateFigureIntoCache (FigCch_NUM_GSTS,Hie_SYS,-1L, + FigCch_Type_UNSIGNED,&NumGsts); + } + HTM_Unsigned (NumGsts); HTM_TD_End (); HTM_TD_Begin ("class=\"%s\"",Class); diff --git a/swad_figure_cache.c b/swad_figure_cache.c index cb765f8b7..d475d8871 100644 --- a/swad_figure_cache.c +++ b/swad_figure_cache.c @@ -25,10 +25,7 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ -//#define _GNU_SOURCE // For asprintf #include // For sscanf -//#include // For system, getenv, etc. -//#include // For string functions #include "swad_database.h" #include "swad_figure_cache.h" @@ -83,6 +80,7 @@ void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure, *((unsigned *) ValuePtr)); break; case FigCch_Type_DOUBLE: + Str_SetDecimalPointToUS (); // To write the decimal point as a dot DB_QueryREPLACE ("can not update cached figure value", "REPLACE INTO figures" " (Figure,Scope,Cod,ValueInt,ValueDouble)" @@ -90,6 +88,7 @@ void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure, " (%u,'%s',%ld,0,'%.15lg')", (unsigned) Figure,Sco_GetDBStrFromScope (Scope),Cod, *((double *) ValuePtr)); + Str_SetDecimalPointToLocal (); // Return to local system break; } } @@ -150,8 +149,10 @@ bool FigCch_GetFigureFromCache (FigCch_FigureCached_t Figure, Found = true; break; case FigCch_Type_DOUBLE: + Str_SetDecimalPointToUS (); // To write the decimal point as a dot if (sscanf (row[0],"%lf",(double *) ValuePtr) == 1) Found = true; + Str_SetDecimalPointToLocal (); // Return to local system break; } } diff --git a/swad_figure_cache.h b/swad_figure_cache.h index c0c887b1b..8ee1026d0 100644 --- a/swad_figure_cache.h +++ b/swad_figure_cache.h @@ -51,16 +51,17 @@ typedef enum FigCch_NUM_NETS_IN_CRSS = 8, // Number of non-editing teachers in courses FigCch_NUM_TCHS_IN_CRSS = 9, // Number of teachers in courses FigCch_NUM_USRS_IN_CRSS = 10, // Number of users in courses + FigCch_NUM_GSTS = 11, // Number of guests (users not belonging to any course) //-------------------------------------------------------------------------- - FigCch_NUM_CRSS_PER_USR = 11, // Number of courses per user - FigCch_NUM_CRSS_PER_STD = 12, // Number of courses per student - FigCch_NUM_CRSS_PER_NET = 13, // Number of courses per non-editing teacher - FigCch_NUM_CRSS_PER_TCH = 14, // Number of courses per teacher + FigCch_NUM_CRSS_PER_USR = 12, // Number of courses per user + FigCch_NUM_CRSS_PER_STD = 13, // Number of courses per student + FigCch_NUM_CRSS_PER_NET = 14, // Number of courses per non-editing teacher + FigCch_NUM_CRSS_PER_TCH = 15, // Number of courses per teacher //-------------------------------------------------------------------------- - FigCch_NUM_USRS_PER_CRS = 15, // Number of users per course - FigCch_NUM_STDS_PER_CRS = 16, // Number of students per course - FigCch_NUM_NETS_PER_CRS = 17, // Number of non-editing teachers per course - FigCch_NUM_TCHS_PER_CRS = 18, // Number of teachers per course + FigCch_NUM_USRS_PER_CRS = 16, // Number of users per course + FigCch_NUM_STDS_PER_CRS = 17, // Number of students per course + FigCch_NUM_NETS_PER_CRS = 18, // Number of non-editing teachers per course + FigCch_NUM_TCHS_PER_CRS = 19, // Number of teachers per course } FigCch_FigureCached_t; #define FigCch_NUM_TYPES 2