Version 16.16.1

This commit is contained in:
Antonio Cañas Vargas 2016-10-07 09:57:28 +02:00
parent 157c4912ea
commit 0b253eb929
2 changed files with 29 additions and 6 deletions

View File

@ -146,13 +146,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.16 (2016-10-07)"
#define Log_PLATFORM_VERSION "SWAD 16.16.1 (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.1: Oct 07, 2016 Fixed bug in user's usage report. (206108 lines)
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)

View File

@ -848,23 +848,45 @@ static void Rep_WriteSectionHistoricCourses (const struct UsrFigures *UsrFigures
static unsigned long Rep_GetMaxHitsPerYear (time_t FirstClickTimeUTC)
{
char Query[512];
char Query[1024];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned long MaxHitsPerYear = 0;
sprintf (Query,"SELECT MAX(N) FROM (SELECT "
sprintf (Query,"SELECT MAX(N) FROM ("
// Clicks without course selected ---------------------------
"SELECT "
"'-1' AS CrsCod,"
"YEAR(CONVERT_TZ(ClickTime,@@session.time_zone,'UTC')) AS Year,"
"'%u' AS Role,"
"COUNT(*) AS N"
" FROM log_full"
" WHERE ClickTime>=FROM_UNIXTIME('%ld')"
" AND UsrCod='%ld'"
" AND CrsCod<='0'"
" GROUP BY Year"
// ----------------------------------------------------------
" UNION "
// Clicks as student or teacher in courses ------------------
"SELECT "
"CrsCod,"
"YEAR(CONVERT_TZ(ClickTime,@@session.time_zone,'UTC')) AS Year,"
"Role,"
"COUNT(*) AS N"
" FROM log_full"
" WHERE ClickTime>=FROM_UNIXTIME('%ld')"
" AND UsrCod='%ld' AND Role>='%u' AND Role<='%u'"
" GROUP BY CrsCod,Year,Role)"
" AS hits_per_crs_year",
" AND UsrCod='%ld'"
" AND Role>='%u'" // Student
" AND Role<='%u'" // Teacher
" AND CrsCod>'0'"
" GROUP BY CrsCod,Year,Role"
// ----------------------------------------------------------
") AS hits_per_crs_year",
(unsigned) Rol_UNKNOWN,
(long) FirstClickTimeUTC,
Gbl.Usrs.Me.UsrDat.UsrCod,
(long) FirstClickTimeUTC,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Rol_STUDENT,
(unsigned) Rol_TEACHER);
DB_QuerySELECT (Query,&mysql_res,"can not get last question index");