diff --git a/swad_changelog.h b/swad_changelog.h index 507679ddc..62aa777c3 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -111,11 +111,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.42.2 (2015/11/21)" +#define Log_PLATFORM_VERSION "SWAD 15.42.3 (2015/11/21)" // 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.42.3: Nov 21, 2015 Stats of hits distributed by week depend on user's preference about first day of the week. (187528 lines) Version 15.42.2: Nov 21, 2015 Fixed bug in JavaScript code to draw months. (187524 lines) Version 15.42.1: Nov 21, 2015 Calendar is drawn depending on user's preference about first day of the week. (187523 lines) Version 15.42: Nov 21, 2015 New option in preferences to select first day of the week. (187520 lines) diff --git a/swad_statistic.c b/swad_statistic.c index 7da6eacb5..edb65b5a2 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -1023,14 +1023,17 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) break; case Sta_CLICKS_CRS_PER_WEEKS: case Sta_CLICKS_GBL_PER_WEEKS: - /* With %v the weeks always are counted from monday to sunday. - 01/01/2006 was sunday => it's counted in the week 52 of 2005, that goes from 26/12/2005 (monday) to 01/01/2006 (sunday). - The week 1 of 2006 goes from 02/01/2006 (monday) to 08/01/2006 (sunday) */ - sprintf (Query,"SELECT SQL_NO_CACHE " - "DATE_FORMAT(CONVERT_TZ(ClickTime,@@session.time_zone,'%s'),'%%x%%v') AS Week," - "%s FROM %s", - BrowserTimeZone, - StrQueryCountType,LogTable); + /* With %x%v the weeks are counted from monday to sunday. + With %X%V the weeks are counted from sunday to saturday. */ + sprintf (Query,(Gbl.Prefs.FirstDayOfWeek == 0) ? + "SELECT SQL_NO_CACHE " // Weeks start on monday + "DATE_FORMAT(CONVERT_TZ(ClickTime,@@session.time_zone,'%s'),'%%x%%v') AS Week," + "%s FROM %s" : + "SELECT SQL_NO_CACHE " // Weeks start on sunday + "DATE_FORMAT(CONVERT_TZ(ClickTime,@@session.time_zone,'%s'),'%%X%%V') AS Week," + "%s FROM %s", + BrowserTimeZone, + StrQueryCountType,LogTable); break; case Sta_CLICKS_CRS_PER_MONTHS: case Sta_CLICKS_GBL_PER_MONTHS: