You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I've narrowed down this issue to this method.I know that ranked-model attempts to always populate the column on save but it's possible if you have an existing dataset, bypass callbacks, that you could still have nil values making this an issue.
Not sure what the right solution is, but I feel like this situation should be gracefully handled somehow. Happy to open a PR with a little guidance. Thanks!
The text was updated successfully, but these errors were encountered:
mattvague
changed the title
Invalid SQL in relative_rank when column is nil
Invalid SQL in relative_rank when order column is nil
Jun 1, 2021
mattvague
changed the title
Invalid SQL in relative_rank when order column is nil
Invalid SQL in relative_rank when order column value is nil
Jun 1, 2021
Hi @mattvague, I'm not too sure what to do about this. It looks like you're explicit calling branch_order_rank on this item? Perhaps you could check if the branch_order is nil first?
If that's not the code path then I'd be keen to know what it is to see if we can cope.
My suggestion would be to add mechanisms on your end to keep your data clean (if it has a tendency to get out of order). If you don't bypass the callbacks and ensure any existing data is fixed up before using ranked-model you should have a better time :)
If you have a model with
nil
as the position in the database, callingmodel. branch_order_rank
will raise an error due to invalid SQL, eg:I think I've narrowed down this issue to this method.I know that
ranked-model
attempts to always populate the column on save but it's possible if you have an existing dataset, bypass callbacks, that you could still have nil values making this an issue.Not sure what the right solution is, but I feel like this situation should be gracefully handled somehow. Happy to open a PR with a little guidance. Thanks!
The text was updated successfully, but these errors were encountered: