diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 97e833c0..57c440d2 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -1,12 +1,22 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/swad_changelog.h b/swad_changelog.h
index fd4b3919..626b70d1 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -340,7 +340,7 @@ Buenos d
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 18.0 (2018-10-04)"
+#define Log_PLATFORM_VERSION "SWAD 18.1 (2018-10-07)"
#define CSS_FILE "swad17.25.4.css"
#define JS_FILE "swad17.17.1.js"
@@ -359,6 +359,7 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
/*
+ Version 18.1: Oct 07, 2018 New statistics grouped per year. (234943 lines)
Version 18.0.1: Oct 04, 2018 My courses are highlighted in listing of courses of current degree. (234738 lines)
Version 18.0: Oct 04, 2018 New version of fotomaton, programmed by Daniel Calandria and Jesús Mesa.
Changes in code to avoid new warnings with GCC 7.3. (234736 lines)
diff --git a/swad_date.c b/swad_date.c
index 447753d7..60ac491a 100644
--- a/swad_date.c
+++ b/swad_date.c
@@ -1009,37 +1009,7 @@ void Dat_WriteRFC822DateFromTM (FILE *File,struct tm *tm_ptr)
}
/*****************************************************************************/
-/************** Compute the preceding date of a given date *******************/
-/*****************************************************************************/
-
-void Dat_GetDateBefore (struct Date *Date,struct Date *PrecedingDate)
- {
- if (Date->Day == 1)
- {
- if (Date->Month == 1)
- {
- PrecedingDate->Year = Date->Year - 1;
- PrecedingDate->Month = 12;
- PrecedingDate->Day = 31;
- }
- else
- {
- PrecedingDate->Year = Date->Year;
- PrecedingDate->Month = Date->Month - 1;
- PrecedingDate->Day = (PrecedingDate->Month == 2) ? Dat_GetNumDaysFebruary (PrecedingDate->Year) :
- Dat_NumDaysMonth[PrecedingDate->Month];
- }
- }
- else
- {
- PrecedingDate->Year = Date->Year;
- PrecedingDate->Month = Date->Month;
- PrecedingDate->Day = Date->Day - 1;
- }
- }
-
-/*****************************************************************************/
-/************** Compute the preceding date of a given date *******************/
+/************** Compute the subsequent date of a given date ******************/
/*****************************************************************************/
void Dat_GetDateAfter (struct Date *Date,struct Date *SubsequentDate)
@@ -1070,6 +1040,36 @@ void Dat_GetDateAfter (struct Date *Date,struct Date *SubsequentDate)
}
}
+/*****************************************************************************/
+/************** Compute the preceding date of a given date *******************/
+/*****************************************************************************/
+
+void Dat_GetDateBefore (struct Date *Date,struct Date *PrecedingDate)
+ {
+ if (Date->Day == 1)
+ {
+ if (Date->Month == 1)
+ {
+ PrecedingDate->Year = Date->Year - 1;
+ PrecedingDate->Month = 12;
+ PrecedingDate->Day = 31;
+ }
+ else
+ {
+ PrecedingDate->Year = Date->Year;
+ PrecedingDate->Month = Date->Month - 1;
+ PrecedingDate->Day = (PrecedingDate->Month == 2) ? Dat_GetNumDaysFebruary (PrecedingDate->Year) :
+ Dat_NumDaysMonth[PrecedingDate->Month];
+ }
+ }
+ else
+ {
+ PrecedingDate->Year = Date->Year;
+ PrecedingDate->Month = Date->Month;
+ PrecedingDate->Day = Date->Day - 1;
+ }
+ }
+
/*****************************************************************************/
/**************** Compute the week before to a given week ********************/
/*****************************************************************************/
@@ -1106,6 +1106,15 @@ void Dat_GetMonthBefore (struct Date *Date,struct Date *PrecedingDate)
}
}
+/*****************************************************************************/
+/**************** Compute the year before to a given year ********************/
+/*****************************************************************************/
+
+void Dat_GetYearBefore (struct Date *Date,struct Date *PrecedingDate)
+ {
+ PrecedingDate->Year = Date->Year - 1;
+ }
+
/*****************************************************************************/
/************** Compute the number of days beteen two dates ******************/
/*****************************************************************************/
@@ -1113,7 +1122,8 @@ void Dat_GetMonthBefore (struct Date *Date,struct Date *PrecedingDate)
// If the old date is the day before the new data, return 2
// ...
-unsigned Dat_GetNumDaysBetweenDates (struct Date *DateIni,struct Date *DateEnd)
+unsigned Dat_GetNumDaysBetweenDates (struct Date *DateIni,
+ struct Date *DateEnd)
{
int DiffDays;
unsigned Year;
@@ -1138,7 +1148,8 @@ unsigned Dat_GetNumDaysBetweenDates (struct Date *DateIni,struct Date *DateEnd)
/*****************************************************************************/
// If the two dates are in the same week, return 1
-unsigned Dat_GetNumWeeksBetweenDates (struct Date *DateIni,struct Date *DateEnd)
+unsigned Dat_GetNumWeeksBetweenDates (struct Date *DateIni,
+ struct Date *DateEnd)
{
int DiffWeeks;
unsigned Year;
@@ -1148,7 +1159,8 @@ unsigned Dat_GetNumWeeksBetweenDates (struct Date *DateIni,struct Date *DateEnd)
if (DateIni->Year > DateEnd->Year)
return 0;
- /***** Initial year is lower or equal to ending year ==> compute difference in weeks *****/
+ /***** Initial year is lower or equal to ending year ==>
+ compute difference in weeks *****/
DiffWeeks = (int) DateEnd->Week - (int) DateIni->Week + 1;
for (Year = DateIni->Year;
Year < DateEnd->Year;
@@ -1163,7 +1175,8 @@ unsigned Dat_GetNumWeeksBetweenDates (struct Date *DateIni,struct Date *DateEnd)
/*****************************************************************************/
// If the two dates are in the same month, return 1
-unsigned Dat_GetNumMonthsBetweenDates (struct Date *DateIni,struct Date *DateEnd)
+unsigned Dat_GetNumMonthsBetweenDates (struct Date *DateIni,
+ struct Date *DateEnd)
{
int DiffMonths;
@@ -1174,6 +1187,22 @@ unsigned Dat_GetNumMonthsBetweenDates (struct Date *DateIni,struct Date *DateEnd
0;
}
+/*****************************************************************************/
+/************** Compute the number of years between two dates ****************/
+/*****************************************************************************/
+// If the two dates are in the same year, return 1
+
+unsigned Dat_GetNumYearsBetweenDates (struct Date *DateIni,
+ struct Date *DateEnd)
+ {
+ int DiffYears;
+
+ /***** Compute the difference in years *****/
+ DiffYears = (int) DateEnd->Year - (int) DateIni->Year + 1;
+ return (DiffYears > 0) ? (unsigned) DiffYears :
+ 0;
+ }
+
/*****************************************************************************/
/*************** Compute the number of days in a given year ******************/
/*****************************************************************************/
diff --git a/swad_date.h b/swad_date.h
index d52b9c36..cadf0dc2 100644
--- a/swad_date.h
+++ b/swad_date.h
@@ -162,13 +162,19 @@ void Dat_GetIniEndDatesFromForm (void);
void Dat_WriteRFC822DateFromTM (FILE *File,struct tm *tm);
-void Dat_GetDateBefore (struct Date *Date,struct Date *PrecedingDate);
-void Dat_GetDateAfter (struct Date *Date,struct Date *SubsequentDate);
-void Dat_GetWeekBefore (struct Date *Date,struct Date *PrecedingDate);
-void Dat_GetMonthBefore (struct Date *Date,struct Date *PrecedingDate);
-unsigned Dat_GetNumDaysBetweenDates (struct Date *DateIni,struct Date *DateEnd);
-unsigned Dat_GetNumWeeksBetweenDates (struct Date *DateIni,struct Date *DateEnd);
-unsigned Dat_GetNumMonthsBetweenDates (struct Date *DateIni,struct Date *DateEnd);
+void Dat_GetDateAfter (struct Date *Date,struct Date *SubsequentDate);
+void Dat_GetDateBefore (struct Date *Date,struct Date *PrecedingDate );
+void Dat_GetWeekBefore (struct Date *Date,struct Date *PrecedingDate );
+void Dat_GetMonthBefore (struct Date *Date,struct Date *PrecedingDate );
+void Dat_GetYearBefore (struct Date *Date,struct Date *PrecedingDate );
+unsigned Dat_GetNumDaysBetweenDates (struct Date *DateIni,
+ struct Date *DateEnd);
+unsigned Dat_GetNumWeeksBetweenDates (struct Date *DateIni,
+ struct Date *DateEnd);
+unsigned Dat_GetNumMonthsBetweenDates (struct Date *DateIni,
+ struct Date *DateEnd);
+unsigned Dat_GetNumYearsBetweenDates (struct Date *DateIni,
+ struct Date *DateEnd);
unsigned Dat_GetNumDaysInYear (unsigned Year);
unsigned Dat_GetNumDaysFebruary (unsigned Year);
bool Dat_GetIfLeapYear (unsigned Year);
diff --git a/swad_statistic.c b/swad_statistic.c
index 6c71fec7..c8ca0e69 100644
--- a/swad_statistic.c
+++ b/swad_statistic.c
@@ -74,23 +74,25 @@ const unsigned Sta_CellPadding[Sta_NUM_CLICKS_GROUPED_BY] =
2, // Sta_CLICKS_CRS_DETAILED_LIST
1, // Sta_CLICKS_CRS_PER_USR
- 1, // Sta_CLICKS_CRS_PER_DAYS
- 0, // Sta_CLICKS_CRS_PER_DAYS_AND_HOUR
- 1, // Sta_CLICKS_CRS_PER_WEEKS
- 1, // Sta_CLICKS_CRS_PER_MONTHS
+ 1, // Sta_CLICKS_CRS_PER_DAY
+ 0, // Sta_CLICKS_CRS_PER_DAY_AND_HOUR
+ 1, // Sta_CLICKS_CRS_PER_WEEK
+ 1, // Sta_CLICKS_CRS_PER_MONTH
+ 1, // Sta_CLICKS_CRS_PER_YEAR
1, // Sta_CLICKS_CRS_PER_HOUR
0, // Sta_CLICKS_CRS_PER_MINUTE
1, // Sta_CLICKS_CRS_PER_ACTION
- 1, // Sta_CLICKS_GBL_PER_DAYS
- 0, // Sta_CLICKS_GBL_PER_DAYS_AND_HOUR
- 1, // Sta_CLICKS_GBL_PER_WEEKS
- 1, // Sta_CLICKS_GBL_PER_MONTHS
+ 1, // Sta_CLICKS_GBL_PER_DAY
+ 0, // Sta_CLICKS_GBL_PER_DAY_AND_HOUR
+ 1, // Sta_CLICKS_GBL_PER_WEEK
+ 1, // Sta_CLICKS_GBL_PER_MONTH
+ 1, // Sta_CLICKS_GBL_PER_YEAR
1, // Sta_CLICKS_GBL_PER_HOUR
0, // Sta_CLICKS_GBL_PER_MINUTE
1, // Sta_CLICKS_GBL_PER_ACTION
1, // Sta_CLICKS_GBL_PER_PLUGIN
- 1, // Sta_CLICKS_GBL_PER_WEB_SERVICE_FUNCTION
+ 1, // Sta_CLICKS_GBL_PER_API_FUNCTION
1, // Sta_CLICKS_GBL_PER_BANNER
1, // Sta_CLICKS_GBL_PER_COUNTRY
1, // Sta_CLICKS_GBL_PER_INSTITUTION
@@ -140,17 +142,19 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse);
static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql_res);
static void Sta_WriteLogComments (long LogCod);
static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,MYSQL_RES *mysql_res);
-static void Sta_ShowNumHitsPerDays (unsigned long NumRows,MYSQL_RES *mysql_res);
-static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES *mysql_res);
+static void Sta_ShowNumHitsPerDay (unsigned long NumRows,MYSQL_RES *mysql_res);
+static void Sta_ShowDistrAccessesPerDayAndHour (unsigned long NumRows,MYSQL_RES *mysql_res);
static Sta_ColorType_t Sta_GetStatColorType (void);
static void Sta_DrawBarColors (Sta_ColorType_t ColorType,float HitsMax);
static void Sta_DrawAccessesPerHourForADay (Sta_ColorType_t ColorType,float HitsNum[24],float HitsMax);
static void Sta_SetColor (Sta_ColorType_t ColorType,float HitsNum,float HitsMax,
unsigned *R,unsigned *G,unsigned *B);
-static void Sta_ShowNumHitsPerWeeks (unsigned long NumRows,
+static void Sta_ShowNumHitsPerWeek (unsigned long NumRows,
MYSQL_RES *mysql_res);
-static void Sta_ShowNumHitsPerMonths (unsigned long NumRows,
+static void Sta_ShowNumHitsPerMonth (unsigned long NumRows,
MYSQL_RES *mysql_res);
+static void Sta_ShowNumHitsPerYear (unsigned long NumRows,
+ MYSQL_RES *mysql_res);
static void Sta_ShowNumHitsPerHour (unsigned long NumRows,
MYSQL_RES *mysql_res);
static void Sta_WriteAccessHour (unsigned Hour,struct Sta_Hits *Hits,unsigned ColumnWidth);
@@ -739,12 +743,12 @@ void Sta_AskShowGblHits (void)
fprintf (Gbl.F.Out,"