diff --git a/swad_changelog.h b/swad_changelog.h index 611885d0a..166a51f54 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -135,13 +135,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.252 (2016-09-12)" +#define Log_PLATFORM_VERSION "SWAD 15.252.1 (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.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) Version 15.251.1: Sep 11, 2016 Changes in user's usage report. (204406 lines) diff --git a/swad_report.c b/swad_report.c index a27cd871e..b7ada7971 100644 --- a/swad_report.c +++ b/swad_report.c @@ -73,6 +73,7 @@ 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); /*****************************************************************************/ /********* Show my usage report (report on my use of the platform) ***********/ @@ -557,15 +558,15 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim /* Write the month */ fprintf (Gbl.F.Out,"" "" - "%04u-%02u " + "%04u-%02u: " "", Date.Year,Date.Month); /* Draw bar proportional to number of pages generated */ - Sta_DrawBarNumHits ('c', + Rep_DrawBarNumHits ('c', M == NumMonthsBetweenLastDateAndCurrentDate ? Hits.Num : 0.0, - Hits.Max,Hits.Total,500); + Hits.Max,500); /* Decrease month */ Dat_GetMonthBefore (&Date,&Date); @@ -582,12 +583,12 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim /* Write the month */ fprintf (Gbl.F.Out,"" "" - "%04u-%02u " + "%04u-%02u" "", Date.Year,Date.Month); /* Draw bar proportional to number of pages generated */ - Sta_DrawBarNumHits ('c',0.0,Hits.Max,Hits.Total,500); + Rep_DrawBarNumHits ('c',0.0,Hits.Max,500); /* Decrease month */ Dat_GetMonthBefore (&Date,&Date); @@ -595,3 +596,38 @@ static void Rep_ShowMyHits (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTim fprintf (Gbl.F.Out,""); } + +/*****************************************************************************/ +/********************* Draw a bar with the number of hits ********************/ +/*****************************************************************************/ + +static void Rep_DrawBarNumHits (char Color,float HitsNum,float HitsMax,unsigned MaxBarWidth) + { + unsigned BarWidth; + + fprintf (Gbl.F.Out,""); + + 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); + + /***** Write the number of hits *****/ + Str_WriteFloatNum (HitsNum); + } + else + /***** Write the number of clicks *****/ + fprintf (Gbl.F.Out,"0"); + + fprintf (Gbl.F.Out,"" + ""); + } + diff --git a/swad_statistic.c b/swad_statistic.c index 511994d2e..86083ea55 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -176,6 +176,8 @@ static void Sta_WriteDegree (long DegCod); static void Sta_ShowNumHitsPerCourse (unsigned long NumRows, MYSQL_RES *mysql_res); +static void Sta_DrawBarNumHits (char Color,float HitsNum,float HitsMax,float HitsTotal,unsigned MaxBarWidth); + static void Sta_GetAndShowHierarchyStats (void); static void Sta_WriteHeadDegsCrssInSWAD (void); static void Sta_GetAndShowNumCtysInSWAD (void); @@ -3718,7 +3720,7 @@ void Sta_ComputeMaxAndTotalHits (struct Sta_Hits *Hits, /********************* Draw a bar with the number of hits ********************/ /*****************************************************************************/ -void Sta_DrawBarNumHits (char Color,float HitsNum,float HitsMax,float HitsTotal,unsigned MaxBarWidth) +static void Sta_DrawBarNumHits (char Color,float HitsNum,float HitsMax,float HitsTotal,unsigned MaxBarWidth) { unsigned BarWidth; diff --git a/swad_statistic.h b/swad_statistic.h index e297ceed9..49dc5b3df 100644 --- a/swad_statistic.h +++ b/swad_statistic.h @@ -165,8 +165,6 @@ void Pho_PutHiddenParamFigureType (void); void Sta_ShowUseOfPlatform (void); unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role); -void Sta_DrawBarNumHits (char Color,float HitsNum,float HitsMax,float HitsTotal,unsigned MaxBarWidth); - void Sta_WriteParamsDatesSeeAccesses (void); void Sta_ComputeTimeToGeneratePage (void);