Skip to content

Commit 7287f0f

Browse files
committed
fix: ignore notes sent from self
1 parent ac99fdb commit 7287f0f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/api/entities/unit_role_entity.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ def staff?(my_role)
1313

1414
expose :mentor_id, if: ->(unit_role, options) { staff?(options[:my_role]) }
1515
expose :tutor_note_count, if: ->(unit_role, options) { unit_role.unit.unit_role_for(options[:user])&.id == unit_role.id } do |unit_role, options|
16-
unit_role.tutor_notes.where(read_by_unit_role: false).count
16+
unit_role.tutor_notes
17+
.where(read_by_unit_role: false)
18+
.where.not(user_id: options[:user].id)
19+
.count
1720
end
1821

1922
expose :can_mark_overflow_tasks, if: ->(unit_role, options) { staff?(options[:my_role]) }

0 commit comments

Comments
 (0)