allow teachers to set lti submission type when grading
Refs PFS-4941 Test plan: - Create an assignment in a course with an active student - As a teacher, use submissions update endpoint to assign a submission type of 'basic_lti_launch' and url to student - Verify submission has been updated with correct submission type and url - Create another assignment with any online submission types - As a student, submit to the assignment - As a teacher, use the submissions update endpoint to attempt to assign a submission type of 'basic_lti_launch' and url for student - Verify submission type used by student remains, and changes attempted by teacher were not applied Change-Id: I2bd7f3345df06135cd0328fc87826563b2481bad Reviewed-on: https://gerrit.instructure.com/86183 Tested-by: Jenkins Reviewed-by: Keith T. Garner <kgarner@instructure.com> Reviewed-by: Neil Gupta <ngupta@instructure.com> QA-Review: Amber Taniuchi <amber@instructure.com> Product-Review: Christi Wruck
This commit is contained in:
parent
c870e081f5
commit
18af33a308
|
@ -599,6 +599,10 @@ class SubmissionsApiController < ApplicationController
|
|||
submission[:excuse] = params[:submission].delete(:excuse)
|
||||
submission[:provisional] = value_to_boolean(params[:submission][:provisional])
|
||||
submission[:final] = value_to_boolean(params[:submission][:final]) && @context.grants_right?(@current_user, :moderate_grades)
|
||||
if params[:submission][:submission_type] == 'basic_lti_launch' && (!@submission.has_submission? || @submission.submission_type == 'basic_lti_launch')
|
||||
submission[:submission_type] = params[:submission][:submission_type]
|
||||
submission[:url] = params[:submission][:url]
|
||||
end
|
||||
end
|
||||
if submission[:grade] || submission[:excuse]
|
||||
begin
|
||||
|
|
|
@ -2161,6 +2161,57 @@ describe 'Submissions API', type: :request do
|
|||
{ expected_status: 400 })
|
||||
expect(json["error"]).not_to be_nil
|
||||
end
|
||||
|
||||
it "allows a LTI launch URL to be assigned" do
|
||||
json = api_call(
|
||||
:put,
|
||||
"/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}/submissions/#{@student.id}.json",
|
||||
{
|
||||
controller: 'submissions_api',
|
||||
action: 'update',
|
||||
format: 'json',
|
||||
course_id: @course.id.to_s,
|
||||
assignment_id: @assignment.id.to_s,
|
||||
user_id: @student.id.to_s
|
||||
}, {
|
||||
submission: {
|
||||
posted_grade: 'B',
|
||||
submission_type: 'basic_lti_launch',
|
||||
url: 'http://example.test'
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
expect(Submission.count).to eq 1
|
||||
expect(json['submission_type']).to eql 'basic_lti_launch'
|
||||
expect(json['url']).to eql 'http://example.test'
|
||||
end
|
||||
|
||||
it 'does not allow a submission to be overwritten if type is a non-lti type' do
|
||||
submission = @assignment.submit_homework(@student, body: 'what')
|
||||
json = api_call(
|
||||
:put,
|
||||
"/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}/submissions/#{@student.id}.json",
|
||||
{
|
||||
controller: 'submissions_api',
|
||||
action: 'update',
|
||||
format: 'json',
|
||||
course_id: @course.id.to_s,
|
||||
assignment_id: @assignment.id.to_s,
|
||||
user_id: @student.id.to_s
|
||||
}, {
|
||||
submission: {
|
||||
posted_grade: 'B',
|
||||
submission_type: 'basic_lti_launch',
|
||||
url: 'http://example.test'
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
expect(Submission.count).to eq 1
|
||||
expect(json['submission_type']).to eql 'online_text_entry'
|
||||
expect(json['url']).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it "should allow posting grade by sis id" do
|
||||
|
|
Loading…
Reference in New Issue