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

Commit

Permalink
Fix recurring blackout date creation
Browse files Browse the repository at this point in the history
Resolves #1698
  • Loading branch information
orenyk committed Nov 24, 2017
1 parent 438ab47 commit ddb7b26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Fixed the equipment model seed script generator ([#1662](https://github.com/YaleSTC/reservations/issues/1662)).
* Fixed broken database migrations ([#1676](https://github.com/YaleSTC/reservations/issues/1676), [#1684](https://github.com/YaleSTC/reservations/issues/1684)).
* 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)).
* Fixed the creation of recurring blackouts ([#1698](https://github.com/YaleSTC/reservations/issues/1698)).

### Added
* Added ordering of equipment models within the catalog ([#1418](https://github.com/YaleSTC/reservations/issues/1418)).
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/blackouts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# frozen_string_literal: true

class BlackoutsController < ApplicationController
load_and_authorize_resource
before_action :set_current_blackout,
only: [:edit, :show, :update, :destroy, :destroy_recurring]
only: %i[edit show update destroy destroy_recurring]

# ---------- before filter methods ------------ #

Expand Down Expand Up @@ -31,8 +32,7 @@ def new_recurring
end_date: Time.zone.today + 1.day)
end

def edit
end
def edit; end

def create_recurring
# called when a recurring blackout is needed
Expand All @@ -41,7 +41,7 @@ def create_recurring

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

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

0 comments on commit ddb7b26

Please sign in to comment.