Skip to content

Commit

Permalink
Set start date explicitly only when changing schedule interval
Browse files Browse the repository at this point in the history
Otherwise the start date would be set every time, also when
changing the start date.

https://bugzilla.redhat.com/show_bug.cgi?id=1392351
  • Loading branch information
mzazrivec committed Nov 24, 2016
1 parent 48e8352 commit 611bdfa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/controllers/report_controller/schedules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,13 @@ def schedule_form_field_changed
page.replace("schedule_email_options_div", :partial => "schedule_email_options")
end

# when timer_typ set to hourly set starting date to current day otherwise it's the day after
if params[:timer_typ] == 'Hourly'
@edit[:new][:timer].start_date = Time.zone.now.strftime("%m/%d/%Y")
else
@edit[:new][:timer].start_date = (Time.zone.now + 1.day).strftime("%m/%d/%Y")
if params[:timer_typ].present?
# when timer_typ set to hourly set starting date to current day otherwise it's the day after
if params[:timer_typ] == 'Hourly'
@edit[:new][:timer].start_date = Time.zone.now.strftime("%m/%d/%Y")
else
@edit[:new][:timer].start_date = (Time.zone.now + 1.day).strftime("%m/%d/%Y")
end
end
page << "$('#miq_date_1').val('#{@edit[:new][:timer].start_date}');"

Expand Down

0 comments on commit 611bdfa

Please sign in to comment.