diff --git a/sql/cambios.sql b/sql/cambios.sql index 95d0107a4..03a9bf542 100644 --- a/sql/cambios.sql +++ b/sql/cambios.sql @@ -11643,3 +11643,8 @@ SELECT SQL_NO_CACHE YEAR(CONVERT_TZ(ClickTime,@@session.time_zone,'Europe/Berlin CREATE TABLE IF NOT EXISTS usr_report (RepCod INT NOT NULL AUTO_INCREMENT,UsrCod INT NOT NULL,ReportTimeUTC DATETIME NOT NULL,UniqueDirL CHAR(2) NOT NULL,UniqueDirR CHAR(41) NOT NULL,Filename VARCHAR(255) NOT NULL,Permalink VARCHAR(255) NOT NULL,UNIQUE INDEX(RepCod),INDEX(UsrCod)); + + + + +SELECT CrsCod,COUNT(*) AS N FROM crs_usr LEFT JOIN log_full ON (crs_usr.CrsCod=log_full.CrsCod AND crs_usr.UsrCod=log_full.UsrCod AND crs_usr.Role=log_full.Role) WHERE UsrCod='7' AND Role='3' GROUP BY CrsCod ORDER BY N DESC; diff --git a/swad_changelog.h b/swad_changelog.h index 9e1fd442c..361322c3f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -146,13 +146,16 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.15.6 (2016-10-06)" +#define Log_PLATFORM_VERSION "SWAD 16.16 (2016-10-07)" #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.16: Oct 07, 2016 Order current courses in user's usage report by number of clicks. + Do not write number of users in historic courses. + Clicks without course selected are shown apart. (206085 lines) Version 16.15.6: Oct 06, 2016 Message in user's usage reports. (206027 lines) Version 16.15.5: Oct 06, 2016 Fix bug removing user's usage reports. (206023 lines) Version 16.15.4: Oct 06, 2016 When a user is removed, all his/her user's usage reports are removed. (206022 lines) diff --git a/swad_report.c b/swad_report.c index 773d0b7ee..3f4c9e75c 100644 --- a/swad_report.c +++ b/swad_report.c @@ -116,18 +116,22 @@ static void Rep_WriteSectionHistoricCourses (const struct UsrFigures *UsrFigures unsigned long MaxHitsPerYear); static unsigned long Rep_GetMaxHitsPerYear (time_t FirstClickTimeUTC); -static void Rep_GetAndWriteCurrentCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role, - time_t FirstClickTimeUTC, - const struct tm *tm_FirstClickTime, - unsigned long MaxHitsPerYear); -static void Rep_GetAndWriteHistoricCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role, +static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role, + time_t FirstClickTimeUTC, + const struct tm *tm_FirstClickTime, + unsigned long MaxHitsPerYear); +static void Rep_GetAndWriteMyHistoricClicsWithoutCrs (time_t FirstClickTimeUTC, + const struct tm *tm_FirstClickTime, + unsigned long MaxHitsPerYear); +static void Rep_GetAndWriteMyHistoricCrss (Rol_Role_t Role, time_t FirstClickTimeUTC, const struct tm *tm_FirstClickTime, unsigned long MaxHitsPerYear); static void Rep_WriteRowCrsData (long CrsCod,Rol_Role_t Role, time_t FirstClickTimeUTC, const struct tm *tm_FirstClickTime, - unsigned long MaxHitsPerYear); + unsigned long MaxHitsPerYear, + bool WriteNumUsrs); static void Rep_ShowMyHitsPerYear (bool AnyCourse,long CrsCod,Rol_Role_t Role, time_t FirstClickTimeUTC, @@ -789,9 +793,9 @@ static void Rep_WriteSectionCurrentCourses (const struct UsrFigures *UsrFigures, Role <= Rol_TEACHER; Role++) /* List my courses with this role */ - Rep_GetAndWriteCurrentCrssOfAUsr (&Gbl.Usrs.Me.UsrDat,Role, - UsrFigures->FirstClickTimeUTC,tm_FirstClickTime, - MaxHitsPerYear); + Rep_GetAndWriteMyCurrentCrss (Role, + UsrFigures->FirstClickTimeUTC,tm_FirstClickTime, + MaxHitsPerYear); /***** End of section *****/ fprintf (Gbl.F.Rep,"" @@ -819,12 +823,16 @@ static void Rep_WriteSectionHistoricCourses (const struct UsrFigures *UsrFigures Rep_MIN_CLICKS_CRS); fprintf (Gbl.F.Rep,"