On Tue, Sep 06, 2011 at 03:10:00PM -0700, eric smith wrote:
>
> We have several conditions where we want to be reminded based on a
> date relative to a field in a workitem, not necessarily the workitem
> date.
>
> task => 'prep orientation package' :remind_me => 5 days before the
> [contract date]

Hello Eric,

I know this is not elegant, but I'd do it this way:

---8<---
alice :task => 'prep package', :timers => 
'${r:Time.at(wi.fields['contract_date']) - 5.days}: reminder'
--->8---

(note I've used ActiveSupport #days in this example).

> Not sure if its part of the same use case but you could also see:
>  remind me 5 days before the end of the month,quarter year

That would require a good temporal language in ruote.

Others have implemented such languages in Ruby, I was thinking people would 
simply use the one they prefer in their participants (or in ${r:x} constructs).

  https://github.com/mojombo/chronic
  https://github.com/bokmann/business_time
  https://github.com/dcparker/temporals
  ...

One thing I could do is checking whether the participant class responds to a 
#timers method and call it if present. This is currently only implemented for 
timeouts (via a #rtimeout method (since JRuby forces a #timeout method on every 
object)).

We currently only have

---8<---
class MyParticipant
  include Ruote::LocalParticipant

  def rtimeout(workitem)
    (Time.at(workitem.fields['contract_date']) + 10.days).to_s
  end
end
--->8---

we could thus have also

---8<---
class MyParticipant
  include Ruote::LocalParticipant

  def timers(workitem)
    (Time.at(workitem.fields['contract_date']) - 5.days).to_s + ': ' +
    'reminder'
  end
end
--->8---


Not sure if my answer makes sense, kind regards,

--
John Mettraux - http://lambda.io/processi

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to