Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove course parameter from LtiSyncJob #7258

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Ensured submissions that have been released cannot be recollected from the repo browser (#7254)
- Fix bug where renaming a group to an existing group in a different assignment resulted in incorrect repository mapping (#7224)
- Fix Marks Spreadsheet csv bug of showing incorrect marks (#7257)
- Fix incorrect inclusion of course parameter in LtiSyncJob (#7258)

### 🔧 Internal changes

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/assignments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def upload_config_files
def create_lti_grades
assessment = record
lti_deployments = LtiDeployment.where(course: assessment.course, id: params[:lti_deployments])
@current_job = LtiSyncJob.perform_later(lti_deployments.to_a, assessment, current_course,
@current_job = LtiSyncJob.perform_later(lti_deployments.to_a, assessment,
can_create_users: allowed_to?(:lti_manage?, with: UserPolicy),
can_create_roles: allowed_to?(:manage?, with: RolePolicy))
session[:job_id] = @current_job.job_id
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/lti_sync_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ def self.completed_message(_status)
I18n.t('lti.grade_sync_complete')
end

def perform(lti_deployments, assessment, course, can_create_users: false, can_create_roles: false)
def perform(lti_deployments, assessment, can_create_users: false, can_create_roles: false)
if lti_deployments.empty?
raise I18n.t('lti.no_platform')
end
lti_deployments.each do |deployment|
roster_error = roster_sync(deployment, course,
roster_error = roster_sync(deployment,
[LtiDeployment::LTI_ROLES[:learner], LtiDeployment::LTI_ROLES[:ta]],
can_create_users: can_create_users, can_create_roles: can_create_roles)
if roster_error
Expand Down
6 changes: 3 additions & 3 deletions spec/jobs/lti_sync_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
end

context 'when running as a background job' do
let(:job_args) { [[lti_deployment.id], assessment, course] }
let(:job_args) { [[lti_deployment.id], assessment] }

include_examples 'background job'
end

context 'when running as a background job, with an lti line item' do
before { create(:lti_line_item, lti_deployment: lti_deployment, assessment: assessment) }

let(:job_args) { [[lti_deployment.id], assessment, assessment.course] }
let(:job_args) { [[lti_deployment.id], assessment] }

include_examples 'background job'
end

context 'with no lti deployments' do
let(:job_args) { [[], assessment, course] }
let(:job_args) { [[], assessment] }

it 'should raise an error' do
expect { LtiSyncJob.perform_now(*job_args) }.to raise_error(RuntimeError)
Expand Down