Skip to content

users table not sorting on department or org#2786

Merged
raycarrick-ed merged 7 commits intomasterfrom
paginate_related
Jan 22, 2021
Merged

users table not sorting on department or org#2786
raycarrick-ed merged 7 commits intomasterfrom
paginate_related

Conversation

@raycarrick-ed
Copy link
Contributor

Fixes #2785.

Changes proposed in this PR:

  • if sorting on a related model (e.g. dept or org) need to form the scope differently to include the related table

@raycarrick-ed raycarrick-ed self-assigned this Jan 21, 2021
@raycarrick-ed raycarrick-ed requested a review from briri January 21, 2021 15:35
@briri
Copy link
Contributor

briri commented Jan 21, 2021

That's really strange. I can confirm its failing in DMPTool as well.

The sort works though for other tables like the Admin -> Plans one:

<th scope="col"><%= _('Project Title') %>&nbsp;<%= paginable_sort_link('plans.title') %></th>
<th scope="col"><%= _('Template') %>&nbsp;<%= paginable_sort_link('templates.title') %></th>
<th scope="col"><%= _('Organisation') %>&nbsp;<%= paginable_sort_link('orgs.name') %></th>

It looks like the Users view uses the same paginable_sort_link. Perhaps the issue lies in the users.rb model or the controllers/paginable/users_controller.rb

@briri
Copy link
Contributor

briri commented Jan 21, 2021

Ah I see, its an issue with table name orgs vs active model's association name org.

Copy link
Contributor

@briri briri left a comment

Choose a reason for hiding this comment

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

I ran this locally and everything seemed to be working properly. I verified that a few of the other paginable views are still working.

It looks like you just have a few Rubocop issues to clean up then feel free to merge.

@raycarrick-ed raycarrick-ed merged commit d49ef75 into master Jan 22, 2021
@raycarrick-ed raycarrick-ed deleted the paginate_related branch January 22, 2021 13:13
portagenetwork pushed a commit to portagenetwork/roadmap that referenced this pull request Feb 24, 2022
users table not sorting on department or org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sorting of user table fails

2 participants