I have a Person model with a points attribute. For the most part, points values will be incremented and decremented via user votes. However, I''d also like to decrement a Person''s points by half a point each day. How do I automatically decrement the value once per day? Your help is greatly appreciated :) Becky -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Id suggest using a database job but you could always just store when you last decreased it date and then on sign in do the decrease. If you plan on showing other users the points you''d need the job. On May 30, 2010 12:37 PM, "Becky Russoniello" <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: I have a Person model with a points attribute. For the most part, points values will be incremented and decremented via user votes. However, I''d also like to decrement a Person''s points by half a point each day. How do I automatically decrement the value once per day? Your help is greatly appreciated :) Becky -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Tim, Thanks for responding. Sorry if this is a dumb question, but what do you mean by database job? This is going to be a ranked list (current points value determines the ranking), and I''d like users to be able to view the list without being logged in. Tim Lovett wrote:> Id suggest using a database job but you could always just store when you > last decreased it date and then on sign in do the decrease. If you plan > on > showing other users the points you''d need the job. >-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I would use a scheduler for this kind of stuff. A pure ruby solution is rufus scheduler: http://github.com/jmettraux/rufus-scheduler With rufus scheduler you can schedule a routine that runs every day at a given hour and decrements every persons points by 0.5. On May 30, 8:35 pm, Becky Russoniello <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi Tim, > > Thanks for responding. Sorry if this is a dumb question, but what do > you mean by database job? > > This is going to be a ranked list (current points value determines the > ranking), and I''d like users to be able to view the list without being > logged in. > > Tim Lovett wrote: > > Id suggest using a database job but you could always just store when you > > last decreased it date and then on sign in do the decrease. If you plan > > on > > showing other users the points you''d need the job. > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Wow! Perfect. Thank you so much. Sharagoz wrote:> I would use a scheduler for this kind of stuff. A pure ruby solution > is rufus scheduler: > http://github.com/jmettraux/rufus-scheduler > With rufus scheduler you can schedule a routine that runs every day at > a given hour and decrements every persons points by 0.5.-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
no scheduler solution: why not use created_at or updated_at? simply get current date than compute days since your prefered event and make it half... On Sun, May 30, 2010 at 6:26 PM, Becky Russoniello <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Wow! Perfect. Thank you so much. > > > Sharagoz wrote: > > I would use a scheduler for this kind of stuff. A pure ruby solution > > is rufus scheduler: > > http://github.com/jmettraux/rufus-scheduler > > With rufus scheduler you can schedule a routine that runs every day at > > a given hour and decrements every persons points by 0.5. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Seemingly Similar Threads
- How to implement a schedule of recurring events?
- [PATCH v3 2/2] virtio: decrement avail idx with buffer detach for packed ring
- [PATCH v3 2/2] virtio: decrement avail idx with buffer detach for packed ring
- Scheduled tasks in Rails: Cron + wget = Best solution?
- [PATCH] virtio: decrement dev_index when device is unregistered