diff --git a/app/coffeescripts/views/assignments/EditView.coffee b/app/coffeescripts/views/assignments/EditView.coffee index ed7f98c8ff8..45e372399d4 100644 --- a/app/coffeescripts/views/assignments/EditView.coffee +++ b/app/coffeescripts/views/assignments/EditView.coffee @@ -407,7 +407,7 @@ export default class EditView extends ValidatedFormView _.extend data, use_rce_enhancements: ENV?.use_rce_enhancements - assignment_attempts: ENV?.FEATURES?.assignment_attempts + assignment_attempts: ENV?.assignment_attempts_enabled kalturaEnabled: ENV?.KALTURA_ENABLED or false postToSISEnabled: ENV?.POST_TO_SIS or false postToSISName: ENV.SIS_NAME @@ -713,7 +713,7 @@ export default class EditView extends ValidatedFormView errors _validateAllowedAttempts: (data, errors) => - return errors unless ENV?.FEATURES?.assignment_attempts + return errors unless ENV?.assignment_attempts_enabled return errors if @lockedItems.settings # field will be disabled and not submitted value = parseInt(data.allowed_attempts, 10) unless value > 0 || value == -1 @@ -819,7 +819,7 @@ export default class EditView extends ValidatedFormView ReactDOM.render(formFieldGroup, mountPoint) renderAllowedAttempts: -> - return if !ENV?.FEATURES?.assignment_attempts + return if !ENV?.assignment_attempts_enabled props = { limited: @model.get('allowed_attempts') > 0 attempts: @model.get('allowed_attempts') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 20729d4559a..aa15f6e4005 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -172,7 +172,6 @@ class ApplicationController < ActionController::Base show_feedback_link: show_feedback_link? }, FEATURES: { - assignment_attempts: Account.site_admin.feature_enabled?(:assignment_attempts), assignment_bulk_edit: Account.site_admin.feature_enabled?(:assignment_bulk_edit), la_620_old_rce_init_fix: Account.site_admin.feature_enabled?(:la_620_old_rce_init_fix), cc_in_rce_video_tray: Account.site_admin.feature_enabled?(:cc_in_rce_video_tray), diff --git a/app/views/assignments/edit.html.erb b/app/views/assignments/edit.html.erb index e03c4901377..87cbc8942cd 100644 --- a/app/views/assignments/edit.html.erb +++ b/app/views/assignments/edit.html.erb @@ -24,6 +24,7 @@ <% provide :right_side, render(:partial => 'shared/wiki_sidebar') %> <% + js_env :assignment_attempts_enabled => @context.feature_enabled?(:assignment_attempts) css_bundle :assignments, :assignments_edit, :tinymce js_bundle :assignment_edit %> @@ -65,4 +66,4 @@ <% end %> <%= render partial: "shared/rubrics_component" %> -<% end %> \ No newline at end of file +<% end %> diff --git a/config/feature_flags/learning_activities_release_flags.yml b/config/feature_flags/learning_activities_release_flags.yml index 03963b1c8ca..10a3b2195a0 100644 --- a/config/feature_flags/learning_activities_release_flags.yml +++ b/config/feature_flags/learning_activities_release_flags.yml @@ -24,7 +24,7 @@ assignments_2_teacher: state: disabled assignment_attempts: state: hidden - applies_to: SiteAdmin + applies_to: Course display_name: Assignment Allowed Attempts description: Allow a teacher to set the number of allowed attempts on an assignment via the UI assignment_bulk_edit: diff --git a/spec/selenium/assignments/assignment_edit_spec.rb b/spec/selenium/assignments/assignment_edit_spec.rb index 0c84c316147..8fdb3f497e9 100644 --- a/spec/selenium/assignments/assignment_edit_spec.rb +++ b/spec/selenium/assignments/assignment_edit_spec.rb @@ -31,20 +31,21 @@ describe "assignment" do @teacher1.register! @course1.enroll_teacher(@teacher1, :enrollment_state => 'active') @assignment1 = @course1.assignments.create!( - :title => 'Existing Assignment', - :points_possible => 10, + :title => 'Existing Assignment', + :points_possible => 10, :submission_types => "online_url,online_upload,online_text_entry" ) @assignment2_paper = @course1.assignments.create!( - :title => 'Existing Assignment', - :points_possible => 10, + :title => 'Existing Assignment', + :points_possible => 10, :submission_types => "on_paper" ) end context "with feature on" do before(:each) do - Account.site_admin.enable_feature! :assignment_attempts + Account.site_admin.allow_feature! :assignment_attempts + @course1.enable_feature! :assignment_attempts user_session(@teacher1) end @@ -63,24 +64,24 @@ describe "assignment" do it "with feature on, displays the attempts field on create view" do AssignmentCreateEditPage.visit_new_assignment_create_page(@course1.id) click_option(AssignmentCreateEditPage.submission_type_selector, "External Tool") - + expect(AssignmentCreateEditPage.limited_attempts_fieldset.displayed?).to be true end it "with feature on, hides the attempts field on create view when no submissions is needed" do AssignmentCreateEditPage.visit_new_assignment_create_page(@course1.id) click_option(AssignmentCreateEditPage.submission_type_selector, "No Submission") - + expect(AssignmentCreateEditPage.limited_attempts_fieldset.displayed?).to be false end it "allows user to set submission limit", custom_timeout: 25 do AssignmentCreateEditPage.visit_assignment_edit_page(@course1.id, @assignment1.id) click_option(AssignmentCreateEditPage.limited_attempts_dropdown, "Limited") - + # default attempt count is 1 expect(AssignmentCreateEditPage.limited_attempts_input.attribute('value')).to eq "1" - + # increase attempts count AssignmentCreateEditPage.increase_attempts_btn.click() AssignmentCreateEditPage.assignment_save_button.click() @@ -90,4 +91,4 @@ describe "assignment" do end end end -end \ No newline at end of file +end