From 2efbaebe631601cd7d5b5bd96149b29222e1c65b Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 23 Jun 2019 08:35:55 +0100 Subject: [PATCH] Fix validation of metric thresholds. Closes #3549 --- app/Http/Controllers/Dashboard/MetricController.php | 6 ++---- app/Models/Metric.php | 8 -------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/Dashboard/MetricController.php b/app/Http/Controllers/Dashboard/MetricController.php index 56a4f6e9e15a..1a0b601c7458 100644 --- a/app/Http/Controllers/Dashboard/MetricController.php +++ b/app/Http/Controllers/Dashboard/MetricController.php @@ -45,8 +45,7 @@ public function showMetrics() public function showAddMetric() { return View::make('dashboard.metrics.add') - ->withPageTitle(trans('dashboard.metrics.add.title').' - '.trans('dashboard.dashboard')) - ->withAcceptableThresholds(Metric::ACCEPTABLE_THRESHOLDS); + ->withPageTitle(trans('dashboard.metrics.add.title').' - '.trans('dashboard.dashboard')); } /** @@ -132,8 +131,7 @@ public function showEditMetricAction(Metric $metric) { return View::make('dashboard.metrics.edit') ->withPageTitle(trans('dashboard.metrics.edit.title').' - '.trans('dashboard.dashboard')) - ->withMetric($metric) - ->withAcceptableThresholds(Metric::ACCEPTABLE_THRESHOLDS); + ->withMetric($metric); } /** diff --git a/app/Models/Metric.php b/app/Models/Metric.php index 8b5bc2d629c3..8f1e98df0af7 100644 --- a/app/Models/Metric.php +++ b/app/Models/Metric.php @@ -62,13 +62,6 @@ class Metric extends Model implements HasPresenter */ const VISIBLE_HIDDEN = 2; - /** - * Array of acceptable threshold minutes. - * - * @var int[] - */ - const ACCEPTABLE_THRESHOLDS = [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60]; - /** * The model's attributes. * @@ -134,7 +127,6 @@ class Metric extends Model implements HasPresenter 'default_value' => 'required|numeric', 'places' => 'required|numeric|between:0,4', 'default_view' => 'required|numeric|between:0,3', - 'threshold' => 'required|numeric|between:0,10', 'visible' => 'required|numeric|between:0,2', ];