don't display 'out of' when we don't need to. fixes #4580
Change-Id: I13b7c835675890f6b84bdacc1f3fe946622abc7e Reviewed-on: https://gerrit.instructure.com/3683 Reviewed-by: Ryan Shaw <ryan@instructure.com> Tested-by: Hudson <hudson@instructure.com> Reviewed-by: JT Olds <jt@instructure.com>
This commit is contained in:
parent
b27b03556e
commit
8da5e4e23c
|
@ -283,7 +283,7 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="min_score_box" style="display: none;">
|
<span class="min_score_box" style="display: none;">
|
||||||
<input type="text" class="min_score" style="width: 35px;"/>
|
<input type="text" class="min_score" style="width: 35px;"/>
|
||||||
<span>out of <span class="points_possible"> </span></span>
|
<span class="points_possible_parent">out of <span class="points_possible"> </span></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<%= image_tag "flagged_question_dim.png", :id => "criterion_image_min_score", :class => "image not_blank", :alt => "minimum score", :title => "Students must get at least a {{ min_score }} on this item before the module is considered complete" %>
|
<%= image_tag "flagged_question_dim.png", :id => "criterion_image_min_score", :class => "image not_blank", :alt => "minimum score", :title => "Students must get at least a {{ min_score }} on this item before the module is considered complete" %>
|
||||||
|
|
|
@ -283,7 +283,10 @@
|
||||||
<% elsif can_do(@submission, @current_user, :read_grade) %>
|
<% elsif can_do(@submission, @current_user, :read_grade) %>
|
||||||
<span class="score" style="<%= hidden if @assignment.grading_type == 'points' %>"><%= @submission.score %></span>
|
<span class="score" style="<%= hidden if @assignment.grading_type == 'points' %>"><%= @submission.score %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
out of <%= @submission.assignment.points_possible %><br/>
|
<% if @submission.assignment.points_possible %>
|
||||||
|
out of <%= @submission.assignment.points_possible %>
|
||||||
|
<% end %>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<% if @submission.turnitin_data && (@submission.current_submission_graded? || can_do(@context, @current_user, :manage_grades)) %>
|
<% if @submission.turnitin_data && (@submission.current_submission_graded? || can_do(@context, @current_user, :manage_grades)) %>
|
||||||
<% if (turnitin_score = @submission.turnitin_data[@submission.asset_string]) && turnitin_score[:similarity_score] %>
|
<% if (turnitin_score = @submission.turnitin_data[@submission.asset_string]) && turnitin_score[:similarity_score] %>
|
||||||
|
|
|
@ -876,11 +876,15 @@ modules.initModuleManagement = function() {
|
||||||
var $option = $(this).parents(".completion_criterion_option");
|
var $option = $(this).parents(".completion_criterion_option");
|
||||||
$option.find(".min_score_box").showIf($(this).val() == 'min_score');
|
$option.find(".min_score_box").showIf($(this).val() == 'min_score');
|
||||||
var id = $option.find(".id").val();
|
var id = $option.find(".id").val();
|
||||||
$option.find(".points_possible").text(
|
var points_possible = $.trim($("#context_module_item_" + id + " .points_possible").text()) ||
|
||||||
$("#context_module_item_" + id + " .points_possible").text() ||
|
// for some reason the previous did not have anything in it sometimes (noticed when you are dealing with a newly added module)
|
||||||
// for some reason the previous did not have anything in it sometimes (noticed when you are dealing with a newly added module)
|
$.trim($("#context_module_item_" + id + " .points_possible_block").text());
|
||||||
$("#context_module_item_" + id + " .points_possible_block").text()
|
if(points_possible.length > 0) {
|
||||||
);
|
$option.find(".points_possible").text(points_possible);
|
||||||
|
$option.find(".points_possible_parent").show();
|
||||||
|
} else {
|
||||||
|
$option.find(".points_possible_parent").hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$("#add_context_module_form .delete_criterion_link").click(function(event) {
|
$("#add_context_module_form .delete_criterion_link").click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
@ -27,7 +27,7 @@ SERVER_PORT = SELENIUM_CONFIG[:app_port] || 3002
|
||||||
APP_HOST = "#{SERVER_IP}:#{SERVER_PORT}"
|
APP_HOST = "#{SERVER_IP}:#{SERVER_PORT}"
|
||||||
SECONDS_UNTIL_COUNTDOWN = 5
|
SECONDS_UNTIL_COUNTDOWN = 5
|
||||||
SECONDS_UNTIL_GIVING_UP = 60
|
SECONDS_UNTIL_GIVING_UP = 60
|
||||||
MAX_SERVER_START_TIME = 30
|
MAX_SERVER_START_TIME = 60
|
||||||
|
|
||||||
module SeleniumTestsHelperMethods
|
module SeleniumTestsHelperMethods
|
||||||
def setup_selenium
|
def setup_selenium
|
||||||
|
@ -90,13 +90,6 @@ module SeleniumTestsHelperMethods
|
||||||
ENV['SELENIUM_WEBRICK_SERVER'] = '1'
|
ENV['SELENIUM_WEBRICK_SERVER'] = '1'
|
||||||
exec("#{base}/../../script/server", "-p", SERVER_PORT.to_s, "-e", Rails.env)
|
exec("#{base}/../../script/server", "-p", SERVER_PORT.to_s, "-e", Rails.env)
|
||||||
end
|
end
|
||||||
for i in 0..MAX_SERVER_START_TIME
|
|
||||||
s = TCPSocket.open('127.0.0.1', SERVER_PORT) rescue nil
|
|
||||||
break if s
|
|
||||||
sleep 1
|
|
||||||
end
|
|
||||||
raise "Failed starting script/server" unless s
|
|
||||||
s.close
|
|
||||||
closed = false
|
closed = false
|
||||||
shutdown = lambda do
|
shutdown = lambda do
|
||||||
unless closed
|
unless closed
|
||||||
|
@ -110,6 +103,13 @@ module SeleniumTestsHelperMethods
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
at_exit { shutdown.call }
|
at_exit { shutdown.call }
|
||||||
|
for i in 0..MAX_SERVER_START_TIME
|
||||||
|
s = TCPSocket.open('127.0.0.1', SERVER_PORT) rescue nil
|
||||||
|
break if s
|
||||||
|
sleep 1
|
||||||
|
end
|
||||||
|
raise "Failed starting script/server" unless s
|
||||||
|
s.close
|
||||||
return shutdown
|
return shutdown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
require File.expand_path(File.dirname(__FILE__) + "/common")
|
||||||
|
|
||||||
|
describe "context_modules selenium tests" do
|
||||||
|
it_should_behave_like "in-process server selenium tests"
|
||||||
|
|
||||||
|
it "should only display 'out-of' on an assignment min score restriction when the assignment has a total" do
|
||||||
|
|
||||||
|
username = "nobody@example.com"
|
||||||
|
password = "asdfasdf"
|
||||||
|
|
||||||
|
u = user_with_pseudonym :active_user => true, :username => username, :password => password
|
||||||
|
u.save!
|
||||||
|
|
||||||
|
e = course_with_teacher :active_course => true, :user => u, :active_enrollment => true
|
||||||
|
e.save!
|
||||||
|
|
||||||
|
course = e.course
|
||||||
|
ag = course.assignment_groups.create!
|
||||||
|
a1 = ag.assignments.create!(:context => course)
|
||||||
|
a1.points_possible = 10
|
||||||
|
a1.save
|
||||||
|
a2 = ag.assignments.create!(:context => course)
|
||||||
|
m = course.context_modules.create!
|
||||||
|
|
||||||
|
make_content_tag = lambda do |assignment|
|
||||||
|
ct = ContentTag.new
|
||||||
|
ct.content_id = assignment.id
|
||||||
|
ct.content_type = 'Assignment'
|
||||||
|
ct.context_id = course.id
|
||||||
|
ct.context_type = 'Course'
|
||||||
|
ct.title = "Assignment #{assignment.id}"
|
||||||
|
ct.tag_type = "context_module"
|
||||||
|
ct.context_module_id = m.id
|
||||||
|
ct.context_code = "course_#{course.id}"
|
||||||
|
ct.save!
|
||||||
|
ct
|
||||||
|
end
|
||||||
|
content_tag_1 = make_content_tag.call a1
|
||||||
|
content_tag_2 = make_content_tag.call a2
|
||||||
|
|
||||||
|
login_as(username, password)
|
||||||
|
|
||||||
|
get "/courses/#{e.course_id}/modules"
|
||||||
|
driver.execute_script("
|
||||||
|
$('#context_module_#{m.id}').find('.edit_module_link').click();
|
||||||
|
$('.add_completion_criterion_link:visible').click();
|
||||||
|
$('.assignment_picker').val(#{content_tag_1.id});
|
||||||
|
$('.assignment_requirement_picker').val('min_score').change();
|
||||||
|
return $('.points_possible_parent:visible').length; ").should > 0
|
||||||
|
driver.execute_script("
|
||||||
|
$('.assignment_picker').val(#{content_tag_2.id});
|
||||||
|
$('.assignment_requirement_picker').val('min_score').change();
|
||||||
|
return $('.points_possible_parent:visible').length; ").should == 0
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue