fix outcome details to show correct numbers

On the outcomes page if you clicked "show details" for an
outcome, it would always say "0 artifacts" even if there
were artifacts.  The problem is it wasn't actually looking
for artifacts, it was looking for something else.  Also
fixed the pageless code on the outcome details page to
correctly do an infinite scroll.

fixes #3823

Change-Id: I6e0fd06ea70e5915ee5cdef23d4851ecd6a285fc
Reviewed-on: https://gerrit.instructure.com/2318
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
This commit is contained in:
Brian Whitmer 2011-02-16 14:02:39 -07:00
parent 47a1fdcf5d
commit b99263ed72
3 changed files with 10 additions and 8 deletions

View File

@ -92,10 +92,6 @@ class LearningOutcome < ActiveRecord::Base
end
end
def artifacts_for(context)
content_tags.active.for_context(context).not_rubric
end
def rubric_criterion=(hash)
criterion = {}
if hash[:enable] != '1'
@ -131,7 +127,15 @@ class LearningOutcome < ActiveRecord::Base
end
def artifacts_count_for_tied_context
self.artifacts_for(@tied_context).count rescue 0
codes = [@tied_context]
if @tied_context.is_a?(Account)
if @tied_context == context
codes = "all"
else
codes = @tied_context.all_courses.scoped({:select => [:id]}).map(&:asset_string)
end
end
self.learning_outcome_results.for_context_codes(codes).count
end
def self.non_rubric_outcomes?

View File

@ -40,9 +40,7 @@
<div id="outcome_results_total_pages"><%= @results.total_pages %></div>
<a href="<%= context_url(@context, :context_outcome_results_url, @outcome.id) %>" style="display: none;" class="outcome_results_url">&nbsp;</a>
<ul>
<% if @context.is_a?(Course) %>
<%= render :partial => "outcome_result" %>
<% end %>
<%= render :partial => "outcome_alignment" %>
</ul>
</div>

View File

@ -34,7 +34,7 @@ $(document).ready(function() {
var $result = $("#result_blank").clone(true).attr('id', 'result_' + result.id);
result.assessed_at_formatted = $.parseFromISO(result.assessed_at).datetime_formatted;
$result.toggleClass('mastery_result', !!result.mastery);
$result.fillTemplateData({data: result, except: ['mastery']});
$result.fillTemplateData({data: result, except: ['mastery'], hrefValues: ['id', 'user_id']});
$("#outcome_results_list").append($result);
$result.show();
}