Modified: branches/event_logging/app/helpers/application_helper.rb (1992 => 1993)
--- branches/event_logging/app/helpers/application_helper.rb 2008-11-20 15:00:39 UTC (rev 1992)
+++ branches/event_logging/app/helpers/application_helper.rb 2008-11-20 15:37:04 UTC (rev 1993)
@@ -1649,9 +1649,10 @@
# get hold of all the items belonging to the current user
# array initialization statement needed to avoid ActiveRecord::AssociationTypeMismatch exception
users_stuff = []
- users_stuff.concat(contributor.workflows)
- users_stuff.concat(contributor.blobs)
- users_stuff.concat(contributor.packs)
+ # user's contributions will contain all workflows/files/packs where the user is original uploader
+ users_stuff.concat (contributor.contributions.collect { |c_ution| c_ution.contributable })
+ # workflows, where WF versions uploaded by the user (when they are not the original uploader) - these aren't included into user's contributions
+ users_stuff.concat(contributor.workflow_versions)
# also, fetch user's favourites
contributor.bookmarks.each do |favourite|
Modified: branches/event_logging/app/models/user.rb (1992 => 1993)
--- branches/event_logging/app/models/user.rb 2008-11-20 15:00:39 UTC (rev 1992)
+++ branches/event_logging/app/models/user.rb 2008-11-20 15:37:04 UTC (rev 1993)
@@ -276,6 +276,12 @@
has_many :workflows, :as => :contributor
has_many :packs, :as => :contributor
+ # this returns workflow instances, where the current user is uploader of a version
+ # (workflow_versions may overlap with workflows (when the user is uploader of the version AND the original uploader of the workflow))
+ has_many :workflow_versions,
+ :class_name => "Workflow",
+ :finder_sql => 'SELECT * FROM workflows w JOIN workflow_versions v ON w.id = v.workflow_id WHERE v.contributor_type = \'User\' AND v.contributor_id = #{id}'
+
acts_as_creditor
acts_as_solr(:fields => [ :name, :tag_list ], :include => [ :profile ]) if SOLR_ENABLE