Skip to content

Commit

Permalink
Fixed couple of curator worklist bugs. WEB-2157 WEB-2164
Browse files Browse the repository at this point in the history
  • Loading branch information
vitthalkudal committed Apr 8, 2011
1 parent fc662ca commit f4ff3ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/data_object.rb
Expand Up @@ -964,6 +964,13 @@ def self.latest_published_version_of(data_object_id)
return nil if obj.blank?
return obj[0]
end

def self.latest_published_version_id(data_object_id)
latest_data_object = DataObject.find_by_sql("SELECT do.id FROM data_objects do_old JOIN data_objects do ON (do_old.guid=do.guid) WHERE do_old.id=#{data_object_id} AND do.published=1 ORDER BY id desc LIMIT 1")
return nil if latest_data_object.blank?
return latest_data_object[0].id
end

def self.latest_published_version_of_guid(guid, options={})
options[:return_only_id] ||= false
select = (options[:return_only_id]) ? 'id' : '*'
Expand Down
3 changes: 3 additions & 0 deletions app/models/user.rb
Expand Up @@ -615,6 +615,9 @@ def images_to_curate(options = {})
last = start + per_page - 1
data_object_ids_to_lookup = data_object_ids[start..last]

# We should not have to do it if the solr index get updated after every content import. Created a ticket WEB-2180 for this.
data_object_ids_to_lookup.collect! {|dato_id| DataObject.latest_published_version_id(dato_id) }.compact!

add_include = [
:all_comments,
{ :users_data_objects => :user },
Expand Down

0 comments on commit f4ff3ba

Please sign in to comment.