On Thu, May 15, 2008 at 2:44 AM, Diego Moreno <[EMAIL PROTECTED]> wrote:
>
> After thinking about all possible options, I try this. In worklist
> model I add this function:
>
> ########### START CODE ##############
>  def workitems_by_type_and_by_space(type, space)

Hi Diego,

I don't see the parameters type and space of your function being used.
Is that what you mean :

---8<---
def workitems_by_type_and_by_space (type, space)

  workitem_list = []

  store_names.each do |store_name|
    workitems(store_name).each do |workitem|
      h = workitem.fields_hash
      workitem_list << workitem if (h['type'] == type and h['space'] == space)
    end
  end

  workitem_list
end
--->8---

?

I will probably update the workitems() method of worklist so that it
returns all the workitems the user has access to if you pass no store
name, it will allow for :

---8<---
def workitems_by_type_and_by_space (type, space)

  workitems.inject([]) do |result, workitem|
    h = workitem.fields_hash
    result << workitem if (h['type'] == type and h['space'] == space)
    result
  end
end
--->8---

http://rubyforge.org/tracker/index.php?func=detail&aid=20146&group_id=2609&atid=10195

(inject() is a great method, see
http://www.ruby-doc.org/core/classes/Enumerable.html#M003160)


Thanks for the feedback, best regards,

-- 
John Mettraux - http://jmettraux.wordpress.com

--~--~---------~--~----~------------~-------~--~----~
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