Combine data with node_id in api output, so its all still "one day", and fits vanilla xboard behaviour

This commit is contained in:
socksprox committed 2025-11-29 14:07:10 +01:00
1 parent 2d7f70d5fb
commit 47f235dffa
2 files changed
+32 -4

No files matched your search

@@ -14,9 +14,20 @@ class StatController extends Controller
public function getTrafficLog(Request $request)
{
$startDate = now()->startOfMonth()->timestamp;
// Aggregate per-node data back to per-day format for backward compatibility
$records = StatUser::query()
->select([
'user_id',
'server_rate',
'record_at',
'record_type',
DB::raw('SUM(u) as u'),
DB::raw('SUM(d) as d'),
])
->where('user_id', $request->user()->id)
->where('record_at', '>=', $startDate)
->groupBy(['user_id', 'server_rate', 'record_at', 'record_type'])
->orderBy('record_at', 'DESC')
->get();