Version 16.4.1

This commit is contained in:
Antonio Cañas Vargas 2016-09-29 01:48:52 +02:00
parent cb5da67771
commit 12b1014988
2 changed files with 40 additions and 22 deletions

View File

@ -142,13 +142,14 @@
/****************************** Public constants *****************************/ /****************************** 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 CSS_FILE "swad15.229.css"
#define JS_FILE "swad15.238.1.js" #define JS_FILE "swad15.238.1.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // 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.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.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. Version 16.3.1: Sep 28, 2016 Two different messagesrelated to new account merged into one.

View File

@ -42,7 +42,7 @@
/***************************** Private constants *****************************/ /***************************** 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 // #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, static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role,
time_t FirstClickTimeUTC, time_t FirstClickTimeUTC,
struct tm *tm_FirstClickTime); struct tm *tm_FirstClickTime,
float MaxHitsPerYear);
static void Rep_WriteRowCrsData (MYSQL_ROW row, static void Rep_WriteRowCrsData (MYSQL_ROW row,
time_t FirstClickTimeUTC, time_t FirstClickTimeUTC,
struct tm *tm_FirstClickTime); struct tm *tm_FirstClickTime,
float MaxHitsPerYear);
static void Rep_ShowMyHitsPerYear (long CrsCod, static float Rep_ShowMyHitsPerYear (long CrsCod,
time_t FirstClickTimeUTC, time_t FirstClickTimeUTC,
struct tm *tm_FirstClickTime); struct tm *tm_FirstClickTime,
float MaxHitsPerYear);
// static void Rep_ShowMyHitsPerMonth (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTime); // static void Rep_ShowMyHitsPerMonth (time_t FirstClickTimeUTC,struct tm *tm_FirstClickTime);
static void Rep_DrawBarNumHits (float HitsNum,float HitsMax, static void Rep_DrawBarNumHits (float HitsNum,float HitsMax,
unsigned MaxBarWidth); unsigned MaxBarWidth);
@ -149,6 +152,7 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint)
unsigned NumPublicFiles; unsigned NumPublicFiles;
Rol_Role_t Role; Rol_Role_t Role;
unsigned NumCrss; unsigned NumCrss;
float MaxHitsPerYear;
/***** Start frame *****/ /***** Start frame *****/
if (SeeOrPrint == Rep_SEE) if (SeeOrPrint == Rep_SEE)
@ -327,6 +331,15 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint)
fprintf (Gbl.F.Out,"</ul>"); fprintf (Gbl.F.Out,"</ul>");
/***** Global hits *****/
fprintf (Gbl.F.Out,"<h2>%s</h2>",Txt_Hits);
MaxHitsPerYear = Rep_ShowMyHitsPerYear (-1L,
UsrFigures.FirstClickTimeUTC,
&tm_FirstClickTime,
-1.0);
// fprintf (Gbl.F.Out,"<br />");
// Rep_ShowMyHitsPerMonth (UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime);
/***** Courses *****/ /***** Courses *****/
fprintf (Gbl.F.Out,"<h2>%s</h2>" fprintf (Gbl.F.Out,"<h2>%s</h2>"
"<ul>", "<ul>",
@ -354,19 +367,14 @@ static void Rep_ShowOrPrintMyUsageReport (Rep_SeeOrPrint_t SeeOrPrint)
/* List my courses with this role */ /* List my courses with this role */
Rep_GetAndWriteCurrentCrssOfAUsr (&Gbl.Usrs.Me.UsrDat,Role, Rep_GetAndWriteCurrentCrssOfAUsr (&Gbl.Usrs.Me.UsrDat,Role,
UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime); UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime,
MaxHitsPerYear);
} }
fprintf (Gbl.F.Out,"</li>"); fprintf (Gbl.F.Out,"</li>");
} }
fprintf (Gbl.F.Out,"</ul>"); fprintf (Gbl.F.Out,"</ul>");
/***** Global hits *****/
fprintf (Gbl.F.Out,"<h2>%s</h2>",Txt_Hits);
Rep_ShowMyHitsPerYear (-1L,UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime);
// fprintf (Gbl.F.Out,"<br />");
// Rep_ShowMyHitsPerMonth (UsrFigures.FirstClickTimeUTC,&tm_FirstClickTime);
/***** End frame *****/ /***** End frame *****/
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
if (SeeOrPrint == Rep_SEE) 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, static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role,
time_t FirstClickTimeUTC, time_t FirstClickTimeUTC,
struct tm *tm_FirstClickTime) struct tm *tm_FirstClickTime,
float MaxHitsPerYear)
{ {
char Query[1024]; char Query[1024];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -433,7 +442,7 @@ static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_R
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
/* Write data of this course */ /* Write data of this course */
Rep_WriteRowCrsData (row,FirstClickTimeUTC,tm_FirstClickTime); Rep_WriteRowCrsData (row,FirstClickTimeUTC,tm_FirstClickTime,MaxHitsPerYear);
} }
/* End table */ /* End table */
@ -450,7 +459,8 @@ static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_R
static void Rep_WriteRowCrsData (MYSQL_ROW row, static void Rep_WriteRowCrsData (MYSQL_ROW row,
time_t FirstClickTimeUTC, 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_YEAR_OF_DEGREE[1+Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_teachers_ABBREVIATION; extern const char *Txt_teachers_ABBREVIATION;
@ -502,7 +512,7 @@ static void Rep_WriteRowCrsData (MYSQL_ROW row,
NumStds,Txt_students_ABBREVIATION); NumStds,Txt_students_ABBREVIATION);
/***** Write hits per year for this course *****/ /***** Write hits per year for this course *****/
Rep_ShowMyHitsPerYear (CrsCod,FirstClickTimeUTC,tm_FirstClickTime); Rep_ShowMyHitsPerYear (CrsCod,FirstClickTimeUTC,tm_FirstClickTime,MaxHitsPerYear);
fprintf (Gbl.F.Out,"</li>"); fprintf (Gbl.F.Out,"</li>");
} }
@ -510,10 +520,12 @@ static void Rep_WriteRowCrsData (MYSQL_ROW row,
/*****************************************************************************/ /*****************************************************************************/
/********************** Write my hits grouped by years ***********************/ /********************** Write my hits grouped by years ***********************/
/*****************************************************************************/ /*****************************************************************************/
// Return the maximum number of hits per year
static void Rep_ShowMyHitsPerYear (long CrsCod, static float Rep_ShowMyHitsPerYear (long CrsCod,
time_t FirstClickTimeUTC, time_t FirstClickTimeUTC,
struct tm *tm_FirstClickTime) struct tm *tm_FirstClickTime,
float MaxHitsPerYear)
{ {
char BrowserTimeZone[Dat_MAX_BYTES_TIME_ZONE+1]; char BrowserTimeZone[Dat_MAX_BYTES_TIME_ZONE+1];
char Query[1024]; char Query[1024];
@ -554,7 +566,10 @@ static void Rep_ShowMyHitsPerYear (long CrsCod,
LastYear = Gbl.Now.Date.Year; LastYear = Gbl.Now.Date.Year;
/***** Compute maximum number of hits per 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 *****/ /***** Write rows *****/
mysql_data_seek (mysql_res,0); mysql_data_seek (mysql_res,0);
@ -597,6 +612,8 @@ static void Rep_ShowMyHitsPerYear (long CrsCod,
/* Draw bar proportional to number of hits */ /* Draw bar proportional to number of hits */
Rep_DrawBarNumHits (0.0,Hits.Max,Rep_MAX_BAR_WIDTH); Rep_DrawBarNumHits (0.0,Hits.Max,Rep_MAX_BAR_WIDTH);
} }
return Hits.Max;
} }
/*****************************************************************************/ /*****************************************************************************/