From 12b1014988a45478dced4a913a5b094dc4756de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 29 Sep 2016 01:48:52 +0200 Subject: [PATCH] Version 16.4.1 --- swad_changelog.h | 3 ++- swad_report.c | 59 +++++++++++++++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index a54070fdd..e975462bb 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -142,13 +142,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.4 (2016-09-29)" +#define Log_PLATFORM_VERSION "SWAD 16.4.1 (2016-09-29)" #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.4.1: Sep 29, 2016 Changes in hits in current courses in user's usage report. (205316 lines) Version 16.4: Sep 29, 2016 Hits in current courses in user's usage report. (205299 lines) Version 16.3.2: Sep 28, 2016 Changes in behaviour of button to follow user. (205277 lines) Version 16.3.1: Sep 28, 2016 Two different messagesrelated to new account merged into one. diff --git a/swad_report.c b/swad_report.c index 751d7b3c5..7ce6d21a7 100644 --- a/swad_report.c +++ b/swad_report.c @@ -42,7 +42,7 @@ /***************************** Private constants *****************************/ /*****************************************************************************/ -#define Rep_MAX_BAR_WIDTH 75 // Maximum width of graphic bar +#define Rep_MAX_BAR_WIDTH 90 // Maximum width of graphic bar // #define Rep_BLOCK "═" // HTML code for a block in graphic bar // #define Rep_BLOCK "▒" // HTML code for a block in graphic bar // #define Rep_BLOCK "█" // HTML code for a block in graphic bar @@ -79,14 +79,17 @@ static void Rep_PutIconToPrintMyUsageReport (void); static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role, time_t FirstClickTimeUTC, - struct tm *tm_FirstClickTime); + struct tm *tm_FirstClickTime, + float MaxHitsPerYear); static void Rep_WriteRowCrsData (MYSQL_ROW row, time_t FirstClickTimeUTC, - struct tm *tm_FirstClickTime); + struct tm *tm_FirstClickTime, + float MaxHitsPerYear); -static void Rep_ShowMyHitsPerYear (long CrsCod, - time_t FirstClickTimeUTC, - struct tm *tm_FirstClickTime); +static float Rep_ShowMyHitsPerYear (long CrsCod, + time_t FirstClickTimeUTC, + struct tm *tm_FirstClickTime, + float MaxHitsPerYear); // static void Rep_ShowMyHitsPerMonth (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTime); static void Rep_DrawBarNumHits (float HitsNum,float HitsMax, unsigned MaxBarWidth); @@ -149,6 +152,7 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) unsigned NumPublicFiles; Rol_Role_t Role; unsigned NumCrss; + float MaxHitsPerYear; /***** Start frame *****/ if (SeeOrPrint == Rep_SEE) @@ -327,6 +331,15 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) fprintf (Gbl.F.Out,""); + /***** Global hits *****/ + fprintf (Gbl.F.Out,"

%s

",Txt_Hits); + MaxHitsPerYear = Rep_ShowMyHitsPerYear (-1L, + UsrFigures.FirstClickTimeUTC, + &tm_FirstClickTime, + -1.0); + // fprintf (Gbl.F.Out,"
"); + // Rep_ShowMyHitsPerMonth (UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime); + /***** Courses *****/ fprintf (Gbl.F.Out,"

%s

" ""); - /***** Global hits *****/ - fprintf (Gbl.F.Out,"

%s

",Txt_Hits); - Rep_ShowMyHitsPerYear (-1L,UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime); - // fprintf (Gbl.F.Out,"
"); - // Rep_ShowMyHitsPerMonth (UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime); - /***** End frame *****/ fprintf (Gbl.F.Out,""); if (SeeOrPrint == Rep_SEE) @@ -393,7 +401,8 @@ static void Rep_PutIconToPrintMyUsageReport (void) static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role, time_t FirstClickTimeUTC, - struct tm *tm_FirstClickTime) + struct tm *tm_FirstClickTime, + float MaxHitsPerYear) { char Query[1024]; MYSQL_RES *mysql_res; @@ -433,7 +442,7 @@ static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_R row = mysql_fetch_row (mysql_res); /* Write data of this course */ - Rep_WriteRowCrsData (row,FirstClickTimeUTC,tm_FirstClickTime); + Rep_WriteRowCrsData (row,FirstClickTimeUTC,tm_FirstClickTime,MaxHitsPerYear); } /* End table */ @@ -450,7 +459,8 @@ static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_R static void Rep_WriteRowCrsData (MYSQL_ROW row, time_t FirstClickTimeUTC, - struct tm *tm_FirstClickTime) + struct tm *tm_FirstClickTime, + float MaxHitsPerYear) { extern const char *Txt_YEAR_OF_DEGREE[1+Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_teachers_ABBREVIATION; @@ -502,7 +512,7 @@ static void Rep_WriteRowCrsData (MYSQL_ROW row, NumStds,Txt_students_ABBREVIATION); /***** Write hits per year for this course *****/ - Rep_ShowMyHitsPerYear (CrsCod,FirstClickTimeUTC,tm_FirstClickTime); + Rep_ShowMyHitsPerYear (CrsCod,FirstClickTimeUTC,tm_FirstClickTime,MaxHitsPerYear); fprintf (Gbl.F.Out,""); } @@ -510,10 +520,12 @@ static void Rep_WriteRowCrsData (MYSQL_ROW row, /*****************************************************************************/ /********************** Write my hits grouped by years ***********************/ /*****************************************************************************/ +// Return the maximum number of hits per year -static void Rep_ShowMyHitsPerYear (long CrsCod, - time_t FirstClickTimeUTC, - struct tm *tm_FirstClickTime) +static float Rep_ShowMyHitsPerYear (long CrsCod, + time_t FirstClickTimeUTC, + struct tm *tm_FirstClickTime, + float MaxHitsPerYear) { char BrowserTimeZone[Dat_MAX_BYTES_TIME_ZONE+1]; char Query[1024]; @@ -554,7 +566,10 @@ static void Rep_ShowMyHitsPerYear (long CrsCod, LastYear = Gbl.Now.Date.Year; /***** Compute maximum number of hits per year *****/ - Sta_ComputeMaxAndTotalHits (&Hits,NumRows,mysql_res,1,1); + if (MaxHitsPerYear >= 0.0) + Hits.Max = MaxHitsPerYear; + else + Sta_ComputeMaxAndTotalHits (&Hits,NumRows,mysql_res,1,1); /***** Write rows *****/ mysql_data_seek (mysql_res,0); @@ -597,6 +612,8 @@ static void Rep_ShowMyHitsPerYear (long CrsCod, /* Draw bar proportional to number of hits */ Rep_DrawBarNumHits (0.0,Hits.Max,Rep_MAX_BAR_WIDTH); } + + return Hits.Max; } /*****************************************************************************/