-
Notifications
You must be signed in to change notification settings - Fork 45
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
Refactoring of affiliations page #1957
base: main
Are you sure you want to change the base?
Conversation
|
||
desc 'get affiliations' | ||
get 'all' do | ||
u_affiliation_ids = UserAffiliation.where(user_id: current_user.id).pluck(:affiliation_id) |
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.
Layout/IndentationWidth: Use 2 (not 1) spaces for indentation.
desc 'get affiliations' | ||
get 'all' do | ||
u_affiliation_ids = UserAffiliation.where(user_id: current_user.id).pluck(:affiliation_id) | ||
@u_affiliations = Affiliation.where(id: u_affiliation_ids).select(:id, :country, :organization, :department, :group, :from, :to).order( |
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.
Layout/LineLength: Line is too long. [144/120]
get 'all' do | ||
u_affiliation_ids = UserAffiliation.where(user_id: current_user.id).pluck(:affiliation_id) | ||
@u_affiliations = Affiliation.where(id: u_affiliation_ids).select(:id, :country, :organization, :department, :group, :from, :to).order( | ||
to: :desc, from: :desc, created_at: :desc) |
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.
Layout/LineLength: Line is too long. [186/120]
get 'all' do | ||
u_affiliation_ids = UserAffiliation.where(user_id: current_user.id).pluck(:affiliation_id) | ||
@u_affiliations = Affiliation.where(id: u_affiliation_ids).select(:id, :country, :organization, :department, :group, :from, :to).order( | ||
to: :desc, from: :desc, created_at: :desc) |
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.
Layout/FirstArgumentIndentation: Indent the first argument one step more than the start of the previous line.
get 'all' do | ||
u_affiliation_ids = UserAffiliation.where(user_id: current_user.id).pluck(:affiliation_id) | ||
@u_affiliations = Affiliation.where(id: u_affiliation_ids).select(:id, :country, :organization, :department, :group, :from, :to).order( | ||
to: :desc, from: :desc, created_at: :desc) |
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.
Layout/MultilineMethodCallBraceLayout: Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
end | ||
put 'update' do | ||
attributes = declared(params, include_missing: false) | ||
Affiliation.find_by_id(params[:id])&.update_columns(attributes) |
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.
Rails/DynamicFindBy: Use find_by
instead of dynamic find_by_id
.
end | ||
put 'update' do | ||
attributes = declared(params, include_missing: false) | ||
Affiliation.find_by_id(params[:id])&.update_columns(attributes) |
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.
Rails/SkipsModelValidations: Avoid using update_columns
because it skips validations.
status 204 | ||
body false | ||
rescue ActiveRecord::RecordInvalid => e | ||
error!({ error: e.message }, 422) |
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.
Layout/IndentationWidth: Use 2 (not 3) spaces for indentation.
status 204 | ||
body false | ||
rescue ActiveRecord::RecordInvalid => e | ||
error!({ error: e.message }, 422) |
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.
Layout/TrailingWhitespace: Trailing whitespace detected.
end | ||
end | ||
end | ||
end |
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.
Layout/TrailingWhitespace: Trailing whitespace detected.
LCOV of commit
|
Refactor affiliations page using React.
Move public apis related to affiliations to affiliations_api