Skip to content
This repository was archived by the owner on Jul 24, 2020. It is now read-only.

Commit ddb7b26

Browse files
committed
Fix recurring blackout date creation
Resolves #1698
1 parent 438ab47 commit ddb7b26

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Fixed the equipment model seed script generator ([#1662](https://github.com/YaleSTC/reservations/issues/1662)).
1313
* Fixed broken database migrations ([#1676](https://github.com/YaleSTC/reservations/issues/1676), [#1684](https://github.com/YaleSTC/reservations/issues/1684)).
1414
* Fixed Heroku deployments by updating post-deploy script and switching to MySQL ([#1680](https://github.com/YaleSTC/reservations/issues/1680), [#1690](https://github.com/YaleSTC/reservations/issues/1690)).
15+
* Fixed the creation of recurring blackouts ([#1698](https://github.com/YaleSTC/reservations/issues/1698)).
1516

1617
### Added
1718
* Added ordering of equipment models within the catalog ([#1418](https://github.com/YaleSTC/reservations/issues/1418)).

app/controllers/blackouts_controller.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# frozen_string_literal: true
2+
23
class BlackoutsController < ApplicationController
34
load_and_authorize_resource
45
before_action :set_current_blackout,
5-
only: [:edit, :show, :update, :destroy, :destroy_recurring]
6+
only: %i[edit show update destroy destroy_recurring]
67

78
# ---------- before filter methods ------------ #
89

@@ -31,8 +32,7 @@ def new_recurring
3132
end_date: Time.zone.today + 1.day)
3233
end
3334

34-
def edit
35-
end
35+
def edit; end
3636

3737
def create_recurring
3838
# called when a recurring blackout is needed
@@ -41,7 +41,7 @@ def create_recurring
4141

4242
@blackout = Blackout.new(blackout_params) # for the form if there are errors
4343

44-
if params[:blackout][:days].first.blank?
44+
if params[:blackout][:days].reject(&:blank?).empty?
4545
flash[:error] = 'You must select at least one day of the week for any '\
4646
'recurring blackouts to be created.'
4747
render('new_recurring') && return

0 commit comments

Comments
 (0)