Fixes issue with setting "or" condition
for "OR" module feature flag Test Plan: * Enable "OR" Condition Feature Flag * Create a module and specify completion requirements with the default setting that ALL requirements must be met to be marked as completed * Log in as a student that has access to the modules; it should not be marked as completed if the student hasn't compeleted the requirement Change-Id: I0c45d13c8dd21a0d5c80c4deb49a6c2c68030342 Reviewed-on: https://gerrit.instructure.com/57506 Reviewed-by: Brock Cooper <bcooper@instructure.com> Tested-by: Jenkins QA-Review: Clare Strong <clare@instructure.com> Product-Review: Brock Cooper <bcooper@instructure.com>
This commit is contained in:
parent
ac95f2d672
commit
cf3d13fb53
|
@ -56,12 +56,12 @@
|
|||
<% if @context.feature_enabled?(:nc_or) %>
|
||||
<div class="ic-Form-control ic-Form-control--radio requirement-count-radio">
|
||||
<div class="ic-Radio">
|
||||
<%= f.radio_button :requirement_count, 0 %>
|
||||
<%= f.label :requirement_count_0, t("Student must complete all of these requirements"), class: "ic-Label" %>
|
||||
<%= f.radio_button :requirement_count, "" %>
|
||||
<%= f.label :requirement_count, t("Student must complete all of these requirements"), class: "ic-Label", value: "" %>
|
||||
</div>
|
||||
<div class="ic-Radio">
|
||||
<%= f.radio_button :requirement_count, 1 %>
|
||||
<%= f.label :requirement_count_1, t("Student must complete one of these requirements"), class: "ic-Label" %>
|
||||
<%= f.label :requirement_count, t("Student must complete one of these requirements"), class: "ic-Label", value: 1 %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -385,8 +385,8 @@ define([
|
|||
$(".requirement-count-radio .ic-Radio").children().show();
|
||||
}
|
||||
|
||||
var $requirmentCount = $module.find('.pill li').data("requirement-count");
|
||||
$requirmentCount == 1 ? $('#context_module_requirement_count_1').prop('checked', true) : $('#context_module_requirement_count_0').prop('checked', true);
|
||||
var $requirementCount = $module.find('.pill li').data("requirement-count");
|
||||
$requirementCount == 1 ? $('#context_module_requirement_count_1').prop('checked', true) : $('#context_module_requirement_count').prop('checked', true);
|
||||
|
||||
$module.fadeIn('fast', function() {
|
||||
});
|
||||
|
@ -653,7 +653,7 @@ define([
|
|||
|
||||
// Update requirement message pill
|
||||
var $pillMessage = $module.find('.pill li');
|
||||
var newPillMessage = data.context_module.requirement_count && data.context_module.requirement_count !== 0 ? I18n.t("Complete One Item") : I18n.t("Complete All Items");
|
||||
var newPillMessage = data.context_module.requirement_count ? I18n.t("Complete One Item") : I18n.t("Complete All Items");
|
||||
$pillMessage.text(newPillMessage);
|
||||
$pillMessage.data("requirement-count", data.context_module.requirement_count);
|
||||
|
||||
|
@ -695,8 +695,14 @@ define([
|
|||
prereqs.push("module_" + id);
|
||||
}
|
||||
});
|
||||
data['context_module[requirement_count]'] = $('input[name="context_module[requirement_count]"]:checked').val();
|
||||
"0";
|
||||
var requirementCount = $('input[name="context_module[requirement_count]"]:checked').val();
|
||||
|
||||
if (requirementCount) {
|
||||
data['context_module[requirement_count]'] = requirementCount;
|
||||
} else {
|
||||
delete data['context_module[requirement_count]'];
|
||||
}
|
||||
|
||||
data['context_module[prerequisites]'] = prereqs.join(",");
|
||||
data['context_module[completion_requirements][none]'] = "none";
|
||||
$(this).find(".criteria_list .criterion").each(function() {
|
||||
|
|
|
@ -456,7 +456,7 @@ describe "context modules" do
|
|||
|
||||
# Test that pill now says Complete One Item right after change and one reload
|
||||
expect(fj('.pill li').text).to eq "Complete One Item"
|
||||
@course.reload
|
||||
get "/courses/#{@course.id}/modules"
|
||||
expect(fj('.pill li').text).to eq "Complete One Item"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue