Refactor: Use strict comparison in chart widget filters (#2498)

Co-authored-by: Alex Justesen <alexjustesen@users.noreply.github.com>
This commit is contained in:
Gurjit Singh
2025-12-06 01:00:44 +01:00
committed by GitHub
parent e2bc2be246
commit bc0064a4ad
6 changed files with 18 additions and 18 deletions
@@ -38,13 +38,13 @@ class RecentDownloadChartWidget extends ChartWidget
$results = Result::query()
->select(['id', 'download', 'created_at'])
->where('status', '=', ResultStatus::Completed)
->when($this->filter == '24h', function ($query) {
->when($this->filter === '24h', function ($query) {
$query->where('created_at', '>=', now()->subDay());
})
->when($this->filter == 'week', function ($query) {
->when($this->filter === 'week', function ($query) {
$query->where('created_at', '>=', now()->subWeek());
})
->when($this->filter == 'month', function ($query) {
->when($this->filter === 'month', function ($query) {
$query->where('created_at', '>=', now()->subMonth());
})
->orderBy('created_at')
@@ -36,13 +36,13 @@ class RecentDownloadLatencyChartWidget extends ChartWidget
$results = Result::query()
->select(['id', 'data', 'created_at'])
->where('status', '=', ResultStatus::Completed)
->when($this->filter == '24h', function ($query) {
->when($this->filter === '24h', function ($query) {
$query->where('created_at', '>=', now()->subDay());
})
->when($this->filter == 'week', function ($query) {
->when($this->filter === 'week', function ($query) {
$query->where('created_at', '>=', now()->subWeek());
})
->when($this->filter == 'month', function ($query) {
->when($this->filter === 'month', function ($query) {
$query->where('created_at', '>=', now()->subMonth());
})
->orderBy('created_at')
@@ -36,13 +36,13 @@ class RecentJitterChartWidget extends ChartWidget
$results = Result::query()
->select(['id', 'data', 'created_at'])
->where('status', '=', ResultStatus::Completed)
->when($this->filter == '24h', function ($query) {
->when($this->filter === '24h', function ($query) {
$query->where('created_at', '>=', now()->subDay());
})
->when($this->filter == 'week', function ($query) {
->when($this->filter === 'week', function ($query) {
$query->where('created_at', '>=', now()->subWeek());
})
->when($this->filter == 'month', function ($query) {
->when($this->filter === 'month', function ($query) {
$query->where('created_at', '>=', now()->subMonth());
})
->orderBy('created_at')
@@ -37,13 +37,13 @@ class RecentPingChartWidget extends ChartWidget
$results = Result::query()
->select(['id', 'ping', 'created_at'])
->where('status', '=', ResultStatus::Completed)
->when($this->filter == '24h', function ($query) {
->when($this->filter === '24h', function ($query) {
$query->where('created_at', '>=', now()->subDay());
})
->when($this->filter == 'week', function ($query) {
->when($this->filter === 'week', function ($query) {
$query->where('created_at', '>=', now()->subWeek());
})
->when($this->filter == 'month', function ($query) {
->when($this->filter === 'month', function ($query) {
$query->where('created_at', '>=', now()->subMonth());
})
->orderBy('created_at')
@@ -38,13 +38,13 @@ class RecentUploadChartWidget extends ChartWidget
$results = Result::query()
->select(['id', 'upload', 'created_at'])
->where('status', '=', ResultStatus::Completed)
->when($this->filter == '24h', function ($query) {
->when($this->filter === '24h', function ($query) {
$query->where('created_at', '>=', now()->subDay());
})
->when($this->filter == 'week', function ($query) {
->when($this->filter === 'week', function ($query) {
$query->where('created_at', '>=', now()->subWeek());
})
->when($this->filter == 'month', function ($query) {
->when($this->filter === 'month', function ($query) {
$query->where('created_at', '>=', now()->subMonth());
})
->orderBy('created_at')
@@ -36,13 +36,13 @@ class RecentUploadLatencyChartWidget extends ChartWidget
$results = Result::query()
->select(['id', 'data', 'created_at'])
->where('status', '=', ResultStatus::Completed)
->when($this->filter == '24h', function ($query) {
->when($this->filter === '24h', function ($query) {
$query->where('created_at', '>=', now()->subDay());
})
->when($this->filter == 'week', function ($query) {
->when($this->filter === 'week', function ($query) {
$query->where('created_at', '>=', now()->subWeek());
})
->when($this->filter == 'month', function ($query) {
->when($this->filter === 'month', function ($query) {
$query->where('created_at', '>=', now()->subMonth());
})
->orderBy('created_at')