From 944165424d377a5988740f92d4475d539524cbb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 12 Sep 2016 10:02:17 +0200 Subject: [PATCH] Version 15.253 --- swad_changelog.h | 3 ++- swad_report.c | 70 +++++++++++++++++++----------------------------- 2 files changed, 29 insertions(+), 44 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 166a51f54..0ba594755 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -135,13 +135,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.252.1 (2016-09-12)" +#define Log_PLATFORM_VERSION "SWAD 15.253 (2016-09-12)" #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 15.253: Sep 12, 2016 Changes in layout of hits per month in user's usage report. (204608 lines) Version 15.252.1: Sep 12, 2016 Hits in user's usage report. Not finished. (204619 lines) Version 15.252: Sep 12, 2016 Hits in user's usage report. Not finished. (204589 lines) Version 15.251.2: Sep 11, 2016 Changes in layout of user's usage report. (204465 lines) diff --git a/swad_report.c b/swad_report.c index b7ada7971..885034aae 100644 --- a/swad_report.c +++ b/swad_report.c @@ -42,6 +42,14 @@ /***************************** Private constants *****************************/ /*****************************************************************************/ +#define Rep_MAX_BAR_WIDTH 75 // 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 +// #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 + /*****************************************************************************/ /****************************** Internal types *******************************/ /*****************************************************************************/ @@ -73,7 +81,8 @@ static void Rep_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t R static void Rep_WriteRowCrsData (MYSQL_ROW row); static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTime); -static void Rep_DrawBarNumHits (char Color,float HitsNum,float HitsMax,unsigned MaxBarWidth); +static void Rep_DrawBarNumHits (float HitsNum,float HitsMax, + unsigned MaxBarWidth); /*****************************************************************************/ /********* Show my usage report (report on my use of the platform) ***********/ @@ -346,13 +355,6 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint) /***** Hits *****/ fprintf (Gbl.F.Out,"

%s

",Txt_Hits); - fprintf (Gbl.F.Out,"2016-04: ███ 300
"); - fprintf (Gbl.F.Out,"2016-05: █ 100
"); - fprintf (Gbl.F.Out,"2016-06: 0
"); - fprintf (Gbl.F.Out,"2016-07: █████ 500
"); - fprintf (Gbl.F.Out,"2016-08: █████████ 900
"); - fprintf (Gbl.F.Out,"2016-09: ██████ 600
"); - Rep_ShowMyHits (UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime); /***** End frame *****/ @@ -532,8 +534,6 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim /***** Compute maximum number of pages generated per month *****/ Sta_ComputeMaxAndTotalHits (&Hits,NumRows,mysql_res,1,1); - fprintf (Gbl.F.Out,""); - /***** Write rows *****/ mysql_data_seek (mysql_res,0); for (NumRow = 1; @@ -546,7 +546,7 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim if (sscanf (row[0],"%04u%02u",&ReadDate.Year,&ReadDate.Month) != 2) Lay_ShowErrorAndExit ("Wrong date."); - /* Get number of pages generated (in row[1]) */ + /* Get number hits (in row[1]) */ Hits.Num = Str_GetFloatNumFromStr (row[1]); Dat_AssignDate (&Date,&LastDate); @@ -556,17 +556,12 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim M++) { /* Write the month */ - fprintf (Gbl.F.Out,"" - "", - Date.Year,Date.Month); + fprintf (Gbl.F.Out,"%04u-%02u ",Date.Year,Date.Month); - /* Draw bar proportional to number of pages generated */ - Rep_DrawBarNumHits ('c', - M == NumMonthsBetweenLastDateAndCurrentDate ? Hits.Num : + /* Draw bar proportional to number of hits */ + Rep_DrawBarNumHits (M == NumMonthsBetweenLastDateAndCurrentDate ? Hits.Num : 0.0, - Hits.Max,500); + Hits.Max,Rep_MAX_BAR_WIDTH); /* Decrease month */ Dat_GetMonthBefore (&Date,&Date); @@ -581,53 +576,42 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim M++) { /* Write the month */ - fprintf (Gbl.F.Out,"" - "", - Date.Year,Date.Month); + fprintf (Gbl.F.Out,"%04u-%02u ",Date.Year,Date.Month); - /* Draw bar proportional to number of pages generated */ - Rep_DrawBarNumHits ('c',0.0,Hits.Max,500); + /* Draw bar proportional to number of hits */ + Rep_DrawBarNumHits (0.0,Hits.Max,Rep_MAX_BAR_WIDTH); /* Decrease month */ Dat_GetMonthBefore (&Date,&Date); } - - fprintf (Gbl.F.Out,"
" - "%04u-%02u: " - "
" - "%04u-%02u" - "
"); } /*****************************************************************************/ /********************* Draw a bar with the number of hits ********************/ /*****************************************************************************/ -static void Rep_DrawBarNumHits (char Color,float HitsNum,float HitsMax,unsigned MaxBarWidth) +static void Rep_DrawBarNumHits (float HitsNum,float HitsMax, + unsigned MaxBarWidth) { unsigned BarWidth; - - fprintf (Gbl.F.Out,""); + unsigned i; if (HitsNum != 0.0) { /***** Draw bar with a with proportional to the number of hits *****/ BarWidth = (unsigned) (((HitsNum * (float) MaxBarWidth) / HitsMax) + 0.5); - if (BarWidth == 0) - BarWidth = 1; - fprintf (Gbl.F.Out,"\"\"" - " ", - Gbl.Prefs.IconsURL,Color,BarWidth); + for (i = 0; + i < BarWidth; + i++) + fprintf (Gbl.F.Out,Rep_BLOCK); /***** Write the number of hits *****/ + fprintf (Gbl.F.Out," "); Str_WriteFloatNum (HitsNum); } else /***** Write the number of clicks *****/ fprintf (Gbl.F.Out,"0"); - fprintf (Gbl.F.Out,"" - ""); + fprintf (Gbl.F.Out,"
"); } -