Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation of metric thresholds #3661

Merged
merged 1 commit into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/Http/Controllers/Dashboard/MetricController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down
8 changes: 0 additions & 8 deletions app/Models/Metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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',
];

Expand Down