so sorry did not realize

Thank you,

Nicole

On Tue, Nov 11, 2014 at 11:04 AM, T.J. Schuck <t...@getharvest.com> wrote:

> Hi Nicole,
>
> This mailing list (rubyonrails-core) is intended for discussion about
> development of the framework itself, not usage of it.
>
> For support issues or usage questions like this one that are not issues
> with Rails itself, please post to the rubyonrails-talk mailing list (
> http://groups.google.com/group/rubyonrails-talk) or somewhere like
> StackOverflow using the `ruby-on-rails` tag (
> http://stackoverflow.com/questions/tagged/ruby-on-rails).  You can also
> drop in to the #rubyonrails channel on irc.freenode.net for realtime
> help.  You'll be more likely to get a quick answer using one of those
> options.
>
> -T.J.
>
> On Tue, Nov 11, 2014 at 8:34 AM, Nicole Morales <nmorale...@gmail.com>
> wrote:
>
>> Hi all
>>
>> Im pretty new to Ruby on Rails.  My boss created an app and is asking me
>> to create a worker to email us when there is a conflict of events for a DJ.
>> It works in the terminal but Im having problems getting the event details
>> of the conflict to display in my mailer.  Im trying to test it out with
>> mail catcher to see if Im doing it correctly but I do not know what to pass
>> for the overlaps parameter in my test.  Below is my code. Can someone help
>> me out?
>>
>> My worker says this(PLEASE LOOK AT THE CAPS)
>>
>> *class TalentConflictsWorker*
>> *    include Sidekiq::Worker*
>> *    include Sidetiq::Schedulable*
>> *    sidekiq_options retry: false*
>>
>> *    MAX_CALENDARS_TO_SCHEDULE_AT_ONCE=10*
>>
>>
>> *    def perform (user_id)*
>>
>> *        user=User.find(user_id)*
>> *        events=user.calendar.events*
>> *        events.each do |e|*
>>             #Checking for conflicting events. If not the same event and
>> has an overlap, display name and start date.
>>          *   overlaps=events.where("(strftime('%s',start) -
>> strftime('%s',?)) * (strftime('%s',?) - strftime('%s',end)) >= 0" ,
>> e.start, e.end ).where.not(id: e.id <http://e.id>)*
>> *            overlapsflag=overlaps.present?*
>>             #overlaps=where("(start,events.end) OVERLAPS (timestamp ?,
>> timestamp ?)" AND not(id: e.id).present?
>>
>>          *   if overlapsflag*
>>
>> *                CalendarMailer.talent_conflict(user, events,
>> overlaps).deliver*
>>
>>                 *#FOR TERMINAL <---THIS WORKS IN THE TERMINAL (when
>> uncommented) MY ISSUE IS HOW DO I PASS THE OVERLAPS AND GET THOSE EVENTS TO
>> DISPLAY IN THE EMAIL*
>>                 #puts "Conflict found", e.name, e.start
>>                 #overlaps.each do |overlap_event|
>>                 #puts overlap_event.name
>>                 #puts overlap_event.start
>>                 #overlapstring=overlap_event.to_s
>>                 #end
>>             #else
>>                 #puts "NO EVENT CONFLICT FOUND"
>>   *          end           *
>> *        end       *
>> *    end*
>> *end*
>>
>> *Heres the mailer I THOUGHT PERHAPS I PUT THE DO LOOP IN THE MAILER? *
>>
>> *def talent_conflict(user, events, overlaps)*
>> *        @user=user*
>> *        @events=events*
>> *        @overlaps= overlaps*
>> *        overlaps.each do |overlap_event|*
>> *                puts overlap_event.name <http://overlap_event.name>*
>> *                puts overlap_event.start*
>> *                #overlapstring=overlap_event.to_s*
>> *            end*
>> *        mail(subject: "SMG Talent: detected an event conflict )")*
>> *    end*
>>
>> *THIS IS THE HTML *
>>
>> *<p>Event conflicts have been detected.</p>*
>>
>> *<ul>*
>>
>> *<li><%= @events.name <http://events.name> %> held on <%= @events.start
>> %> conflicts with the following event: <%= @overlaps.name
>> <http://overlaps.name> %><%= @overlaps.start %></li>*
>>
>>
>> *</ul>*
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to rubyonrails-core+unsubscr...@googlegroups.com.
>> To post to this group, send email to rubyonrails-core@googlegroups.com.
>> Visit this group at http://groups.google.com/group/rubyonrails-core.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ruby on Rails: Core" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/rubyonrails-core/SXrOQeR7XNU/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> rubyonrails-core+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at http://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to