Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix errors/schedules when GET without any errors/schedules available #23

Closed
wants to merge 1 commit into from

2 participants

Gert van der Spoel John Mettraux
Gert van der Spoel

When in the follwing screen:
http://my.domain.com/_ruote/processes/:id

there are 4 GET requests available: expressions, workitems, errors, schedules.

In case there are no errors or no schedules, clicking those links results in an Internal Sever Error.
This is caused by @limit = @count which in case of no results creates @limit = 0.

This in turn causes view/_pagination.html.haml to get a division by 0 situation on the line:
- las = ((@count / lim.to_f).ceil - 1) * lim

Proposed solution sets @skip to nil in case @count = 0 which then skips the pagination section of _pagination.html.haml and will only print 0 errors/schedules.

John Mettraux
Collaborator

Hello Gert,

many thanks for your contribution.

I can't seem to reproduce the issue here.

Launching a new process (no errors, no schedules) then hitting its /_ruote/processes/xxx/errors and /schedules. No "server error" in sight.

I then tried with a fresh checkout of this repo and well, same routine, no "server error" in sight.

Wasn't this fixed in 6829cd5 ?

The repo's pagination is not using

las = ((@count / lim.to_f).ceil - 1) * lim

but

las = lim < 1 ? @count : ((@count / lim.to_f).ceil - 1) * lim

It seems your pull request is started against an older version of ruote-kit.

Thanks,

Gert van der Spoel

Doh, I had actually checked the repo and must have looked over the change already in place.
I didn't realize that the gem is actually from March 2011 so the past 1,5 years worth of updates to this repo are not on rubygems. :(

Sorry for wasting your time!

Gert van der Spoel thunder- closed this
John Mettraux
Collaborator

No waste at all. Please tell me if you need a newer gem pushed to Rubygems. I thought everybody was using it via bundler :git... Sorry.

Gert van der Spoel

For me personally I can just change to the git way to get the latest. Perhaps it is good for the project's visibility to have a newer version available on rubygems. For a relatively new person to start digging into the life of ruby, just going by the gem "ruote-kit" seems to be step 1. And if you are then missing 1,5 years of improvements that's too bad :)

John Mettraux
Collaborator

+1 to your comment
+1 to my TODO list :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 25, 2012
This page is out of date. Refresh to see the latest.
2  lib/ruote-kit/resources/errors.rb
View
@@ -28,7 +28,7 @@ class RuoteKit::Application
respond_with :error
else
@count = @errors.size
- @skip = 0
+ @skip = (@count > 0)? 0 : nil
@limit = @count
respond_with :errors
end
2  lib/ruote-kit/resources/schedules.rb
View
@@ -18,7 +18,7 @@ class RuoteKit::Application
@schedules = RuoteKit.engine.schedules(params[:wfid])
@count = @schedules.size
- @skip = 0
+ @skip = (@count > 0)? 0 : nil
@limit = @count
respond_with :schedules
Something went wrong with that request. Please try again.