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

If field "% Done" is hidden, issue lists showing that field crash Redmine #15

Open
gc-olivierho opened this issue Jan 22, 2016 · 0 comments
Labels

Comments

@gc-olivierho
Copy link

  1. Hide the field "% Done" (field_done_ratio) with your plugin
  2. In a project's Issues tab, display a saved query showing that field
    -> Error 500
    In the log :
    ActionView::Template::Error (undefined method round' for "":String): app/helpers/application_helper.rb:1121:incollect'
    app/helpers/application_helper.rb:1121:in progress_bar' app/helpers/queries_helper.rb:148:incolumn_value'

This is due to query_column_patch.rb which returns "" (empty string) whatever field is hidden.

It would be more appropriate to test the field value type and return something appropriate.
For example,
def value_with_hidden(object)
val = object.send name
if object.respond_to?(:hidden_attribute_names)
hidden_fields = object.hidden_attribute_names.map {|field| field.sub(/_id$/, '')}
if hidden_fields.include?(name.to_s)
case val
when Fixnum
0
when Array
[]
else
""
end

fixes this problem (although maybe some more cases should be defined, I haven't gone through all possibilities).

@alexwais alexwais added the bug label Apr 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants