mirror of
https://github.com/alexjustesen/speedtest-tracker.git
synced 2026-06-23 07:30:09 +00:00
Refactor: Use strict comparison in chart widget filters (#2498)
Co-authored-by: Alex Justesen <alexjustesen@users.noreply.github.com>
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user