fixing scheduling bug

pull/1/head
Jared Cosulich 9 years ago
parent df609c8df8
commit f2141fb6dc

@ -146,7 +146,8 @@ class RecipientSchedule < ApplicationRecord
def self.create_for_recipient(recipient_or_recipient_id, schedule, next_attempt_at=nil)
if next_attempt_at.nil?
next_attempt_at = next_valid_attempt_time
next_attempt_at = Time.at(schedule.start_date.to_time.to_i + (60 * schedule.time))
next_attempt_at += 1.day while next_attempt_at.on_weekend?
end
question_ids = schedule.question_list.question_ids.split(/,/)

@ -4,7 +4,7 @@ class CreateSchedules < ActiveRecord::Migration[5.0]
t.references :school, foreign_key: true
t.string :name
t.text :description
t.integer :frequency_hours
t.integer :frequency_hours, default: 24
t.date :start_date
t.date :end_date
t.boolean :active, default: true

@ -122,7 +122,7 @@ ActiveRecord::Schema.define(version: 20170418173141) do
t.integer "school_id"
t.string "name"
t.text "description"
t.integer "frequency_hours"
t.integer "frequency_hours", default: 24
t.date "start_date"
t.date "end_date"
t.boolean "active", default: true

Loading…
Cancel
Save