From b99263ed72e7d4f08f4cddcc2e66a7e2f9d751b2 Mon Sep 17 00:00:00 2001 From: Brian Whitmer Date: Wed, 16 Feb 2011 14:02:39 -0700 Subject: [PATCH] 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 Reviewed-by: Jon Jensen --- app/models/learning_outcome.rb | 14 +++++++++----- app/views/outcomes/show.html.erb | 2 -- public/javascripts/learning_outcome.js | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/models/learning_outcome.rb b/app/models/learning_outcome.rb index ed16e5217c7..3d187aa6fad 100644 --- a/app/models/learning_outcome.rb +++ b/app/models/learning_outcome.rb @@ -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? diff --git a/app/views/outcomes/show.html.erb b/app/views/outcomes/show.html.erb index f5f00793ce8..747977dff28 100644 --- a/app/views/outcomes/show.html.erb +++ b/app/views/outcomes/show.html.erb @@ -40,9 +40,7 @@
<%= @results.total_pages %>
    - <% if @context.is_a?(Course) %> <%= render :partial => "outcome_result" %> - <% end %> <%= render :partial => "outcome_alignment" %>
\ No newline at end of file diff --git a/public/javascripts/learning_outcome.js b/public/javascripts/learning_outcome.js index 70b34604cd1..ec47f0422ba 100644 --- a/public/javascripts/learning_outcome.js +++ b/public/javascripts/learning_outcome.js @@ -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(); }