-
Notifications
You must be signed in to change notification settings - Fork 570
Add roster identifier to assignment repos endpoint #2439
base: master
Are you sure you want to change the base?
Changes from 6 commits
04682ae
80fd0e9
7daff64
0b19750
55c57fb
04479e0
056d17e
a569c00
5bbc2c1
23484fd
05d75c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ class AssignmentReposController < API::ApplicationController | |
|
|
||
| def index | ||
| repos = AssignmentRepo.where(assignment: @assignment).order(:id) | ||
| paginate json: repos | ||
| paginate json: repos, roster: @assignment.organization.roster | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, didn't see |
||
| end | ||
|
|
||
| def clone_url | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ class AssignmentRepoSerializer < ActiveModel::Serializer | |
| attributes :id | ||
| attributes :username | ||
| attributes :displayName | ||
| attributes :rosterIdentifier | ||
|
|
||
| def username | ||
| object.user.github_user.login | ||
|
|
@@ -13,5 +14,10 @@ def username | |
| def displayName | ||
| object.user.github_user.name || "" | ||
| end | ||
|
|
||
| def rosterIdentifier | ||
| return nil unless instance_options[:roster] | ||
| instance_options[:roster].roster_entries.find_by(user_id: object.user.id)&.identifier | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this an N+1?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The results of the |
||
| end | ||
| # rubocop:enable MethodName | ||
| end | ||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a test which covers this pagination change? Will it be surprising to folks when deployed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
rosterkwarg here doesn't add anything to the JSON payload, it adds context that I can access in the serializer viainstance_options. The alternative is to do something likerepo.assignment.organization.roster.roster_entries.find...for every repo in the serializer 😬