Skip to content

Commit

Permalink
Fix validation of metric thresholds. Closes #3549
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrooksuk committed Jun 23, 2019
1 parent 76e9f41 commit 2efbaeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
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

1 comment on commit 2efbaeb

@GeekJosh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks the add/edit metric screens:
Undefined variable: acceptableThresholds

Please sign in to comment.