Skip to content
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 @@ -26,6 +26,7 @@
- Check against mtime instead of atime for clean up of git repo directories in tmp folder (#7706)
- Update Model: Fix level validation checks through use of a custom validator (#7696)
- Fixed test group results table to display `extra_info` field from all test groups (#7710)
- Fixed syncing grades with Canvas to not include inactive students (#7759)

### 🔧 Internal changes
- Updated Github Actions CI to use cache-apt-pkgs to speed up workflow runs (#7645)
Expand Down
1 change: 1 addition & 0 deletions app/helpers/lti_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def get_assignment_marks(lti_deployment, assignment)
released_results = assignment.released_marks
.joins(grouping: [{ accepted_student_memberships: { role: { user: :lti_users } } }])
.where('lti_users.lti_client': lti_deployment.lti_client)
.where(roles: { hidden: false })
.pluck('lti_users.lti_user_id', 'results.id')
result_ids = released_results.pluck(1)
grades = Result.get_total_marks(result_ids)
Expand Down
43 changes: 43 additions & 0 deletions spec/helpers/lti_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,49 @@
expect(get_assignment_marks(lti_deployment, assessment)).not_to be_empty
end
end

context 'when some students are inactive (hidden)' do
let(:student1) { create(:student, course: course) }
let(:student2) { create(:student, course: course) }
let(:assignment) { create(:assignment, course: course) }

let!(:grouping) do
create(:grouping, assignment: assignment).tap do |g|
create(:student_membership,
grouping: g,
role: student1,
membership_status: StudentMembership::STATUSES[:accepted])

create(:student_membership,
grouping: g,
role: student2,
membership_status: StudentMembership::STATUSES[:accepted])
end
end

before do
create(:result,
grouping: grouping,
released_to_students: true,
marking_state: Result::MARKING_STATES[:complete])

student2.update!(hidden: true)

[student1.user, student2.user].each do |usr|
create(:lti_user, user: usr, lti_client: lti_deployment.lti_client)
end
end

it 'does not include hidden students in the marks hash' do
marks = get_assignment_marks(lti_deployment, assignment)

id1 = student1.user.lti_users.first.lti_user_id
id2 = student2.user.lti_users.first.lti_user_id

expect(marks.keys).to include(id1)
expect(marks.keys).not_to include(id2)
end
end
end

describe '#get_grade_entry_form_marks' do
Expand Down