From 717b14aab87fa1d067296fd21039b2477ddf0f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 3 Oct 2016 10:07:49 +0200 Subject: [PATCH] Version 16.7.7 --- swad_changelog.h | 3 ++- swad_report.c | 34 ++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 9008cdff2..531bb8056 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -143,13 +143,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.7.6 (2016-10-03)" +#define Log_PLATFORM_VERSION "SWAD 16.7.7 (2016-10-03)" #define CSS_FILE "swad15.229.css" #define JS_FILE "swad15.238.1.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 16.7.7: Oct 03, 2016 Code refactoring in user's usage report. (205609 lines) Version 16.7.6: Oct 03, 2016 Code refactoring in user's usage report. (205591 lines) Version 16.7.5: Oct 03, 2016 Code refactoring in user's usage report. (205570 lines) Version 16.7.4: Oct 03, 2016 Code refactoring in user's usage report. (205557 lines) diff --git a/swad_report.c b/swad_report.c index 1c28fa0eb..9c475f15c 100644 --- a/swad_report.c +++ b/swad_report.c @@ -84,6 +84,8 @@ static void Rep_WriteSectionUsrFigures (struct UsrFigures *UsrFigures, struct tm *tm_FirstClickTime, const char *StrCurrentDate, const char *StrCurrentTime); +static void Rep_WriteSectionGlobalHits (struct UsrFigures *UsrFigures, + struct tm *tm_FirstClickTime); static unsigned long Rep_GetMaxHitsPerYear (time_t FirstClickTimeUTC); static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role, @@ -125,7 +127,6 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) extern const char *Txt_Report; extern const char *Txt_Courses; extern const char *Txt_historical_log; - extern const char *Txt_Hits; struct UsrFigures UsrFigures; time_t CurrentTime; struct tm tm_CurrentTime; @@ -180,11 +181,7 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) StrCurrentDate,StrCurrentTime); /***** Global hits *****/ - fprintf (Gbl.F.Out,"

%s

",Txt_Hits); - Rep_ShowMyHitsPerYear (true,-1L,Rol_UNKNOWN, - UsrFigures.FirstClickTimeUTC, - &tm_FirstClickTime, - 0); + Rep_WriteSectionGlobalHits (&UsrFigures,&tm_FirstClickTime); /***** Current courses *****/ fprintf (Gbl.F.Out,"

%s",Txt_Courses); @@ -509,6 +506,31 @@ static void Rep_WriteSectionUsrFigures (struct UsrFigures *UsrFigures, ""); } +/*****************************************************************************/ +/******** Write section for user's global hits in user's usage report ********/ +/*****************************************************************************/ + +static void Rep_WriteSectionGlobalHits (struct UsrFigures *UsrFigures, + struct tm *tm_FirstClickTime) + { + extern const char *Txt_Hits; + + /***** Start of section *****/ + fprintf (Gbl.F.Out,"
" + "

%s

", + Txt_Hits); + + /***** Global (in any course) hits per year *****/ + Rep_ShowMyHitsPerYear (true,-1L, // Any course + Rol_UNKNOWN, // Any role + UsrFigures->FirstClickTimeUTC, + tm_FirstClickTime, + 0); // MaxHitsPerYear not passed as an argument but computed inside the function + + /***** End of section *****/ + fprintf (Gbl.F.Out,"
"); + } + /*****************************************************************************/ /************ Get the maximum number of hits per course-year-role ************/ /*****************************************************************************/