Hello!

No, I don't store any info in a Model - that'd be one of the first
places I'd look for source of the bug.

As for the model's method called (from environment - working only with
"past" auctions, from controller - successfully scheduling
everything), it's pretty straightforward:

(Auction model static method)

  #for application start - schedules auctions which were started
(scheduled) before server restart
  def self.schedule_pending
    #approved:
    auctions = self.find(:all, :conditions => [ "status = ?",
'approved'])
    for auc in auctions
      #double "scheduling" - AuctionSchedule automatically detects
whether auction triggered
      #should be started or finished
      jid1 = $scheduler.schedule_at auc.start_real, :schedulable =>
AuctionSchedule.new, :id => auc.id
      jid2 = $scheduler.schedule_at auc.end_real, :schedulable =>
AuctionSchedule.new, :id =>
    end

    #started:
    auctions = self.find(:all, :conditions => [ "status = ?",
'started'])
    for auc in
      #auction already started - it needs only finishing
      jid = $scheduler.schedule_at auc.end_real, :schedulable =>
AuctionSchedule.new, :id =>
    end
  end


AuctionSchedule model trigger method:
  def trigger
    @auction = Auction.find(params[:id])

    if(@auction.status=='approved')
      @auction.start
    elsif(@auction.status=='started')
      @auction.scheduled_finish
    end
  end


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenWFEru users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to