Skip to content
1 change: 1 addition & 0 deletions app/models/challenge_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def self.order_by_offering_pseud(dir="ASC")
CollectionItem.user_approval_statuses[:approved], CollectionItem.collection_approval_statuses[:approved])
}

scope :fulfilled_unrestricted, -> { fulfilled.where("works.restricted = 0") }

scope :posted, -> { joins(WORKS_JOIN).where("challenge_claims.creation_id IS NOT NULL AND works.posted = 1") }

Expand Down
4 changes: 4 additions & 0 deletions app/models/prompt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ def fulfilled_claims
self.request_claims.fulfilled
end

def fulfilled_unrestricted_claims
self.request_claims.fulfilled_unrestricted
end

# Computes the "full" tag set (tag_set + optional_tag_set), and stores the
# result as an instance variable for speed. This is used by the matching
# algorithm, which doesn't change any signup/prompt/tagset information, so
Expand Down
6 changes: 4 additions & 2 deletions app/views/prompts/_prompt_blurb.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@
<% end %>

<% # if prompt has been fulfilled list works %>
<% unless prompt.unfulfilled? %>
<% unless prompt.unfulfilled? || (guest? && prompt.fulfilled_unrestricted_claims.count < 1) %>
<div class="work listbox group">
<h5 class="heading"><%= ts("Fulfilled By")%></h5>
<ul class="index group">
<% prompt.fulfilled_claims.map(&:creation).each do |creation| %>
<% if creation.is_a?(Work) %>
<%= render "works/work_blurb", :work => creation %>
<% unless guest? && creation.restricted %>
<%= render "works/work_blurb", work: creation %>
<% end %>
<% end %>
<% end %>
</ul>
Expand Down
Loading