make assignment_attempts flag course-level
test plan: * the "Assignment Allowed Attempts" flag should be able to be configured on a course level flag=assignment_attempts closes #UXS-48 Change-Id: Icf467667b5a4205edf4a3f4addd3de53632f00c4 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/230693 Reviewed-by: Jeremy Stanley <jeremy@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Anju Reddy <areddy@instructure.com> Product-Review: Clint Furse <cfurse@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
761d828a1a
commit
e376b17398
|
@ -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')
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<%= render partial: "shared/rubrics_component" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue