Permalink
Browse files

show student progression on module page for large_roster

The module progressions for individual users were removed
for courses with large_roster set. Only the teacher's call
that loads all the progressions for the whole class should
be blocked while still allowing individual's info to load.

Test Plan:
 * on a course with large roster set:
 * create a module with a completion requirement
 * when a student fulfills that requirement, the module page
   should show the green checkmark indicating it is done

closes 	CNVS-5055

Change-Id: Id493459a77c32a7d2a99b19376a822f058896912
Reviewed-on: https://gerrit.instructure.com/19319
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
  • Loading branch information...
1 parent 2028d0d commit 9bb10561cd6c220663aa7f14f7dcb35f10594c6b @bracken bracken committed Apr 3, 2013
@@ -354,8 +354,12 @@ def progressions
if params[:user_id] && @user = @context.students.find(params[:user_id])
@progressions = @context.context_modules.active.map{|m| m.evaluate_for(@user, true, true) }
else
- context_module_ids = @context.context_modules.active.pluck(:id)
- @progressions = ContextModuleProgression.where(:context_module_id => context_module_ids)
+ if @context.large_roster
+ @progressions = []
+ else
+ context_module_ids = @context.context_modules.active.pluck(:id)
+ @progressions = ContextModuleProgression.where(:context_module_id => context_module_ids)
+ end
end
render :json => @progressions.to_json
else
@@ -85,8 +85,6 @@ define([
}
},
updateProgressions: function(user_id, callback) {
- if (ENV.NO_MODULE_PROGRESSIONS) return;
-
var url = $(".progression_list_url").attr('href');
if(user_id) {
url = url + "?user_id=" + user_id;
@@ -398,4 +398,52 @@ def make_content_tag(assignment, course, mod)
end
end
+
+ describe "GET progressions" do
+ before do
+ course_with_student(:active_all => true)
+ @module = @course.context_modules.create!(:name => "first module")
+ @module.publish
+ @wiki = @course.wiki.wiki_pages.create!(:title => "wiki", :body => 'hi')
+
+ @tag = @module.add_item(:id => @wiki.id, :type => 'wiki_page')
+ @module.completion_requirements = {@tag.id => {:type => 'must_view'}}
+ @progression = @module.update_for(@student, :read, @tag)
+ end
+
+ it "should return all student progressions to teacher" do
+ course_with_teacher_logged_in(:course => @course, :active_all => true)
+ get 'progressions', :course_id => @course.id
+ json = JSON.parse response.body.gsub("while(1);",'')
+ json.length.should == 1
+ end
+
+ it "should return a single student progression" do
+ user_session(@student)
+ get 'progressions', :course_id => @course.id
+ json = JSON.parse response.body.gsub("while(1);",'')
+ json.length.should == 1
+ end
+
+ context "with large_roster" do
+ before do
+ @course.large_roster = true
+ @course.save!
+ end
+
+ it "should return a single student progression" do
+ user_session(@student)
+ get 'progressions', :course_id => @course.id
+ json = JSON.parse response.body.gsub("while(1);",'')
+ json.length.should == 1
+ end
+
+ it "should not return any student progressions to teacher" do
+ course_with_teacher_logged_in(:course => @course, :active_all => true)
+ get 'progressions', :course_id => @course.id
+ json = JSON.parse response.body.gsub("while(1);",'')
+ json.length.should == 0
+ end
+ end
+ end
end
@@ -102,6 +102,14 @@ def navigate_to_module_item(module_num, link_text)
validate_context_module_status_text(1, @completed_text)
validate_context_module_status_text(2, @completed_text)
end
+
+ it "should show progression in large_roster courses" do
+ @course.large_roster = true
+ @course.save!
+ go_to_modules
+ navigate_to_module_item(0, @assignment_1.title)
+ validate_context_module_status_text(0, @completed_text)
+ end
it "should validate that a student can't get to a locked context module" do
go_to_modules

0 comments on commit 9bb1056

Please sign in to comment.