* Fix generate zero metric record of week.

This commit is contained in:
qixinzhi
2024-01-11 16:53:40 +08:00
parent 4b72bbd8ee
commit eccfcaa78e
3 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -297,7 +297,7 @@ class baseCalc
if(strlen($dateStr) > 10) $dateStr = substr($dateStr, 0, 10);
$date = DateTime::createFromFormat('Y-m-d', $dateStr);
return $date->format('W');
return substr($date->format('oW'), -2);
}
/**
+1
View File
@@ -1914,6 +1914,7 @@ class metricModel extends model
$month = date('m', $timestamp);
$day = date('d', $timestamp);
$week = date('oW', $timestamp);
$week = substr($week, -2);
$dateValues = new stdClass();
+1 -1
View File
@@ -179,7 +179,7 @@ class metricZen extends metric
*/
protected function prepareMetricRecord($calcList)
{
$options = array('year' => date('Y'), 'month' => date('n'), 'week' => date('W'), 'day' => date('j'));
$options = array('year' => date('Y'), 'month' => date('n'), 'week' => substr(date('oW'), -2), 'day' => date('j'));
$now = helper::now();
$dateValues = $this->metric->generateDateValues($now);