Sorting / Pagination

Expected behavior

I have 269 records in DB. When I filter the view on my state column and go through pages I should not see doublons in my records.

Actual behavior

I actually see doublons !

Context

"database_type": "postgresql",
"framework_version": "5.2.4.1",
"liana": "forest-rails",
"liana_version": "4.1.3",
"orm_version": "5.2.4.1"
"project": "voo"

Hi @ThomasSertorio and welcome into our community :wave: !

I do not reproduce your issue. Did you override any routes ?
It looks like all your record are the same on the second page. Am I wrong ?

Hi @vince, thanks for getting back.

  • I did not override any routes.
  • Not sure what you mean by “all your records are the same” :thinking: ?

Some records are the same as the one on the 1st page and this is my problem… but mostly not

Hi @ThomasSertorio,

What kind of relationship is “Participations” in your ActiveRecord compaign model definition?
Is it a has_many or a many to many relationship?
In other words, are you sure that the 269 participations are unique in terms of influencer?

Thanks for your help!

Hi @arnaud!
campaign has_many :participations and participation belongs_to :influencer.
Yes I am sure the 269 participations are unique in terms of influencer_id. To further illustrate the case, I’v added the participations.id.



As you can see, we have on page 1 and page 2 the same record :man_shrugging:. It might be related to the frontend management of the paginated sort :thinking:

Ok thanks,

Can we do another test to have more insights about the issue?
Could you try to export those 269 participations using the “Export participations” action in the “Actions” dropdown?
Screenshot 2020-08-14 at 11.45.40

Then if it would be great to confirm that the exported CSV file does not contain duplicate influencers.

I have 2 other questions:

  • Do you have the same issue if you order by the id column (and not the state one)?
  • Do you observe this issue only with this relationship in your project?

Alright,
So:

  • I confirm the CSV does not contain any duplicates, I have exactly 269 unique records
  • I don’t have the same issue when ordering on id. The problem occurs with the state field (enum type)
  • It’s difficult to say, if I observe the issue only on this relationship. Others does not necessssarly require pagination. Currently, it is really on this view and it is quite cumbersome as it’s a main admin view.
1 Like

Hi @ThomasSertorio :wave: thank you for your feedback.

There is actually a problem on Forest Admin side, probably due to order by and limit usage with pagination, on non-unique fields. We have to fix it, I opened an issue. Be sure you will be notified as soon as it is resolved. As a workaround, for now, you could try to use search, export, and sorting by ID features. Thank you for your patience and your help in understanding the bug. :pray:

Hey @ThomasSertorio,

are you still experiencing this issue with the latest version ?