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

Refactoring of affiliations page #1957

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ashwiniHerle
Copy link
Contributor

Refactor affiliations page using React.
Move public apis related to affiliations to affiliations_api


desc 'get affiliations'
get 'all' do
u_affiliation_ids = UserAffiliation.where(user_id: current_user.id).pluck(:affiliation_id)
Copy link

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(
Copy link

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)
Copy link

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)
Copy link

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)
Copy link

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)
Copy link

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)
Copy link

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)
Copy link

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)
Copy link

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
Copy link

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.

@ashwiniHerle ashwiniHerle linked an issue Jun 3, 2024 that may be closed by this pull request
3 tasks
Copy link

github-actions bot commented Jun 3, 2024

LCOV of commit b620ef7 during Continuous Integration #2911

Summary coverage rate:
  lines......: 64.1% (13710 of 21376 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

@PiTrem PiTrem linked an issue Jun 18, 2024 that may be closed by this pull request
5 tasks
@PiTrem PiTrem mentioned this pull request Jun 18, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring of the affiliations page Back button on "My past and present affiliations" page does not work
1 participant