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

[MNOE-978] Refactor pagination #673

Open
wants to merge 2 commits into
base: 4.0
Choose a base branch
from

Conversation

iseessel
Copy link
Contributor

No description provided.

@iseessel iseessel changed the title [MNOE-921] Refactor pagination [MNOE-978] Refactor pagination Mar 26, 2018
@@ -1,2 +1,2 @@
json.extract! organization, :id, :name, :uid, :soa_enabled, :created_at, :account_frozen, :financial_metrics, :billing_currency, :external_id, :belong_to_sub_tenant, :belong_to_account_manager, :demo_account

json.role @user.role(organization) if @user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since @user is being passed into the partial in the view (...admin/organizations/show.json.jbuilder), can it be referred to as just user here or can the user: @user be removed from the show view?

@@ -26,6 +26,10 @@ module MnoEnterprise::Concerns::Controllers::Jpi::V1::Admin::OrganizationsContro
#==================================================================
# GET /mnoe/jpi/v1/admin/organizations
def index
# When fetching multiple organizations attached to one user, we must fetch the user's role for each organization.
where = params["where"]
@user = MnoEnterprise::User.find_one(params["where"]["users.id"], :orga_relations) if where && where["users.id"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we refactor this like this maybe?

@user = MnoEnterprise::User.find_one(params["where"]["users.id"], :orga_relations) if params.dig('where', 'users.id')

Then the assignment on line 30 can be removed.

@iseessel iseessel force-pushed the feature/921-refactor-pagination branch 4 times, most recently from ffda3dc to bc501ad Compare March 27, 2018 18:59
Copy link
Contributor

@adamaziz15 adamaziz15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

ouranos
ouranos previously approved these changes Apr 16, 2018
@iseessel iseessel force-pushed the feature/921-refactor-pagination branch from bc501ad to 16aadca Compare April 18, 2018 18:49
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.

3 participants