fixes #1303 move week numbers search out of cache generation block

This commit is contained in:
plegall
2021-01-29 14:31:30 +01:00
parent 1efa9de2a6
commit 3a0e2ca38d
+10 -10
View File
@@ -200,14 +200,12 @@ $week_number = array();
//Array for sorting days in circle size //Array for sorting days in circle size
$temp_data = array(); $temp_data = array();
if (!isset($_SESSION['cache_activity_last_weeks']) or $_SESSION['cache_activity_last_weeks']['calculated_on'] < strtotime('5 minutes ago')) $activity_last_weeks = array();
{ $date = new DateTime();
$activity_last_weeks = array();
$date = new DateTime();
//Get data from $nb_weeks last weeks //Get data from $nb_weeks last weeks
while ($mondays < $nb_weeks) while ($mondays < $nb_weeks)
{ {
if ($date->format('D') == 'Mon') if ($date->format('D') == 'Mon')
{ {
$week_number[] = $date->format('W'); $week_number[] = $date->format('W');
@@ -215,11 +213,13 @@ if (!isset($_SESSION['cache_activity_last_weeks']) or $_SESSION['cache_activity_
} }
$date->sub(new DateInterval('P1D')); $date->sub(new DateInterval('P1D'));
} }
$week_number = array_reverse($week_number); $week_number = array_reverse($week_number);
$date_string = $date->format('Y-m-d');
$date_string = $date->format('Y-m-d'); if (!isset($_SESSION['cache_activity_last_weeks']) or $_SESSION['cache_activity_last_weeks']['calculated_on'] < strtotime('5 minutes ago'))
{
$query = ' $query = '
SELECT SELECT
DATE_FORMAT(occured_on , \'%Y-%m-%d\') AS activity_day, DATE_FORMAT(occured_on , \'%Y-%m-%d\') AS activity_day,