Version 15.222.1

This commit is contained in:
Antonio Cañas Vargas 2016-06-09 14:00:10 +02:00
parent d823690c63
commit 77014a0cb1
3 changed files with 341 additions and 335 deletions

View File

@ -135,13 +135,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.222 (2016-06-09)"
#define Log_PLATFORM_VERSION "SWAD 15.222.1 (2016-06-09)"
#define CSS_FILE "swad15.218.css"
#define JS_FILE "swad15.216.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/*
Version 15.222.1: Jun 09, 2016 Optimization in number of indicators. (202230 lines)
Version 15.222: Jun 09, 2016 Number of indicators is stored in table of courses. (202224 lines)
Version 15.221.4: Jun 09, 2016 New columns in table of courses to store number of indicators. (202153 lines)
1 change necessary in database:

View File

@ -71,7 +71,10 @@ static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
unsigned NumCrss,bool PutForm);
static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t IndicatorsLayout,
unsigned NumCrss,MYSQL_RES *mysql_res);
static void Ind_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators);
static int Ind_GetNumIndicatorsCrsFromDB (long CrsCod);
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators);
static void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
struct Ind_IndicatorsCrs *Indicators);
static unsigned long Ind_GetNumFilesInDocumZonesOfCrsFromDB (long CrsCod);
static unsigned long Ind_GetNumFilesInShareZonesOfCrsFromDB (long CrsCod);
static unsigned long Ind_GetNumFilesInAssigZonesOfCrsFromDB (long CrsCod);
@ -705,7 +708,7 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
long CrsCod;
unsigned NumTchs;
unsigned NumStds;
int NumIndicatorsFromDB;
unsigned NumIndicators;
struct Ind_IndicatorsCrs Indicators;
/***** Table start *****/
@ -985,10 +988,14 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
Lay_ShowErrorAndExit ("Wrong code of course.");
/* Compute indicators of this course */
NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (CrsCod);
Ind_ComputeAndStoreIndicatorsCrs (CrsCod,NumIndicatorsFromDB,&Indicators);
/* Get stored number of indicators of this course */
NumIndicators = Ind_GetAndUpdateNumIndicatorsCrs (CrsCod);
if (Gbl.Stat.IndicatorsSelected[NumIndicators])
{
/* Compute and store indicators */
Ind_ComputeAndStoreIndicatorsCrs (CrsCod,(int) NumIndicators,&Indicators);
/* The number of indicators may have changed */
if (Gbl.Stat.IndicatorsSelected[Indicators.CountIndicators])
{
/* Write a row for this course */
@ -1338,6 +1345,7 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat
}
}
}
}
/***** End table *****/
fprintf (Gbl.F.Out,"</table>");
@ -1370,7 +1378,7 @@ unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod)
/************ Get number of indicators of a course from database *************/
/*****************************************************************************/
int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
static int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
{
char Query[128];
MYSQL_RES *mysql_res;
@ -1400,7 +1408,7 @@ int Ind_GetNumIndicatorsCrsFromDB (long CrsCod)
/************ Store number of indicators of a course in database *************/
/*****************************************************************************/
static void Ind_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators)
static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators)
{
char Query[128];
@ -1416,7 +1424,7 @@ static void Ind_StoreIndicatorsCrs (long CrsCod,unsigned NumIndicators)
/* If number of indicators stored in database is different
from number of indicators just computed ==> update it into database */
void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
static void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
struct Ind_IndicatorsCrs *Indicators)
{
/***** Initialize number of indicators *****/
@ -1477,7 +1485,7 @@ void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
/***** Update number of indicators into database
if different to the stored one *****/
if (NumIndicatorsFromDB != (int) Indicators->CountIndicators)
Ind_StoreIndicatorsCrs (CrsCod,Indicators->CountIndicators);
Ind_StoreIndicatorsCrsIntoDB (CrsCod,Indicators->CountIndicators);
}
/*****************************************************************************/

View File

@ -66,8 +66,5 @@ struct Ind_IndicatorsCrs
void Ind_ReqIndicatorsCourses (void);
void Ind_ShowIndicatorsCourses (void);
unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod);
int Ind_GetNumIndicatorsCrsFromDB (long CrsCod);
void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
struct Ind_IndicatorsCrs *Indicators);
#endif