Page MenuHomePhorge

D1918.1775272703.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D1918.1775272703.diff

diff --git a/src/app/Http/Controllers/API/V4/Admin/StatsController.php b/src/app/Http/Controllers/API/V4/Admin/StatsController.php
--- a/src/app/Http/Controllers/API/V4/Admin/StatsController.php
+++ b/src/app/Http/Controllers/API/V4/Admin/StatsController.php
@@ -105,8 +105,10 @@
while ($weeks > 0) {
$labels[] = $start->format('Y-W');
- $start->subWeeks(1);
$weeks--;
+ if ($weeks) {
+ $start->subWeeks(1);
+ }
}
$labels = array_reverse($labels);
@@ -130,7 +132,7 @@
// $payments = [1000, 1200.25, 3000, 1897.50, 2000, 1900, 2134, 3330];
- $avg = collect($payments)->avg();
+ $avg = collect($payments)->slice(0, count($labels) - 1)->avg();
// See https://frappe.io/charts/docs for format/options description
@@ -171,8 +173,10 @@
while ($weeks > 0) {
$labels[] = $start->format('Y-W');
- $start->subWeeks(1);
$weeks--;
+ if ($weeks) {
+ $start->subWeeks(1);
+ }
}
$labels = array_reverse($labels);
@@ -197,7 +201,7 @@
// $created = [5, 2, 4, 2, 0, 5, 2, 4];
// $deleted = [1, 2, 3, 1, 2, 1, 2, 3];
- $avg = collect($created)->avg();
+ $avg = collect($created)->slice(0, count($labels) - 1)->avg();
// See https://frappe.io/charts/docs for format/options description
@@ -244,8 +248,10 @@
while ($weeks > 0) {
$labels[] = $start->format('Y-W');
- $start->subWeeks(1);
$weeks--;
+ if ($weeks) {
+ $start->subWeeks(1);
+ }
}
$labels = array_reverse($labels);

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 3:18 AM (22 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18827249
Default Alt Text
D1918.1775272703.diff (1 KB)

Event Timeline