Skip to content

Commit

Permalink
updated future meeting check
Browse files Browse the repository at this point in the history
  • Loading branch information
Glenn Harmon committed Nov 5, 2017
1 parent 421a5b1 commit 8bca544
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/models/meeting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ class Meeting < ActiveRecord::Base

attr_accessor :crb_times

scope :next_crb, -> { where(["DATE(time) >= ?", Date.today]).order('time ASC').limit(1) }
# scope :next_crb, -> { where(["DATE(time) >= ?", Date.today]).order('time ASC').limit(1).first }
scope :lecture, -> { where(["format = ?", "Lecture"]) }
scope :current_month_crb, -> { where(["DATE(time) >? AND DATE(time)<?", Time.now.beginning_of_month, Time.now.end_of_month]).order('time ASC').limit(1) }

def self.add_speaker_to_next_meeting(name, title, url)
next_crb.speakers.create!({name: name, title:title, url: url})
find_or_create_next_date.speakers.create!({name: name, title:title, url: url})
end

def self.find_or_create_next_date
if Meeting.next_crb.blank?
next_crb = Meeting.select("time").where(["DATE(time) >= ?", Date.today]).first
if next_crb.blank?
if Meeting.current_month_crb.blank?
next_month = 0
else
Expand Down

0 comments on commit 8bca544

Please sign in to comment.