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

Dashboard page breaks when order by matches higher than result limit #490

Open
wnormand-armor opened this issue Apr 5, 2018 · 0 comments

Comments

@wnormand-armor
Copy link

wnormand-armor commented Apr 5, 2018

I know this isn't an active project but we hit this bug on our production server and it took a while to pin down. To reproduce, create about 10 sensors, set all of them to events_count=0, load the page. The limit=5 will load 5 objects, but the view will then load another 5 objects since it's an unordered collection. I was able to work around this by forcing the sensor to an array before passing to the view.

https://github.com/Snorby/snorby/blob/master/app/controllers/page_controller.rb#L46

-@sensors = Sensor.all(:limit => 5, :order => [:events_count.desc])
+@sensors = Sensor.all(:limit => 5, :order => [:events_count.desc]).to_a # eagerly load the initial result set

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

No branches or pull requests

1 participant