{"action":"created","issue":{"url":"https://api.github.com/repos/maxrossello/redmine_app_timesheets/issues/69","labels_url":"https://api.github.com/repos/maxrossello/redmine_app_timesheets/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/maxrossello/redmine_app_timesheets/issues/69/comments","events_url":"https://api.github.com/repos/maxrossello/redmine_app_timesheets/issues/69/events","html_url":"https://github.com/maxrossello/redmine_app_timesheets/issues/69","id":119399921,"number":69,"title":"Project Roadmap crashes with PostgreSQL","user":{"login":"greyman888","id":7918053,"avatar_url":"https://avatars.githubusercontent.com/u/7918053?v=3","gravatar_id":"","url":"https://api.github.com/users/greyman888","html_url":"https://github.com/greyman888","followers_url":"https://api.github.com/users/greyman888/followers","following_url":"https://api.github.com/users/greyman888/following{/other_user}","gists_url":"https://api.github.com/users/greyman888/gists{/gist_id}","starred_url":"https://api.github.com/users/greyman888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greyman888/subscriptions","organizations_url":"https://api.github.com/users/greyman888/orgs","repos_url":"https://api.github.com/users/greyman888/repos","events_url":"https://api.github.com/users/greyman888/events{/privacy}","received_events_url":"https://api.github.com/users/greyman888/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/maxrossello/redmine_app_timesheets/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-30T00:38:28Z","updated_at":"2015-11-30T13:40:46Z","closed_at":null,"body":"Hi Max,\r\n\r\nBuild: timesheets 1.5.5,  Redmine 3.1, postgresql\r\nConfig: \"Shared versions visible to non members\" set to nil\r\n\r\nBug: Accessing any project roadmap causes a crash.\r\n\r\nThe line that causes the problem is in timeheets_app_project_patch.rb:\r\n\r\n    if Setting.plugin_redmine_app_timesheets[\"public_versions\"].nil?\r\n        @rolled_up_versions = @rolled_up_versions.where(\"#{Version.table_name}.id NOT IN (?)\", noperm + noallow + [\"\"])\r\n    end\r\n\r\nI don't think that postgreSQL likes getting directly fed nil values here.\r\n\r\nIf you change it to the line below, active record seems to take care of it automagically.\r\n\r\n    if Setting.plugin_redmine_app_timesheets[\"public_versions\"].nil?\r\n        @rolled_up_versions = @rolled_up_versions.where.not(id: [noperm, noallow].flatten) \r\n    end\r\n\r\nI must admit, I don't really understand why you have this part of the patch. If you have a little time, could let me know what it does?\r\n\r\nI was going to raise a new pull request, but since I already have one open github wanted to combine this change with the other one.\r\n\r\nAdam\r\n"},"comment":{"url":"https://api.github.com/repos/maxrossello/redmine_app_timesheets/issues/comments/160629309","html_url":"https://github.com/maxrossello/redmine_app_timesheets/issues/69#issuecomment-160629309","issue_url":"https://api.github.com/repos/maxrossello/redmine_app_timesheets/issues/69","id":160629309,"user":{"login":"greyman888","id":7918053,"avatar_url":"https://avatars.githubusercontent.com/u/7918053?v=3","gravatar_id":"","url":"https://api.github.com/users/greyman888","html_url":"https://github.com/greyman888","followers_url":"https://api.github.com/users/greyman888/followers","following_url":"https://api.github.com/users/greyman888/following{/other_user}","gists_url":"https://api.github.com/users/greyman888/gists{/gist_id}","starred_url":"https://api.github.com/users/greyman888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greyman888/subscriptions","organizations_url":"https://api.github.com/users/greyman888/orgs","repos_url":"https://api.github.com/users/greyman888/repos","events_url":"https://api.github.com/users/greyman888/events{/privacy}","received_events_url":"https://api.github.com/users/greyman888/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T13:40:46Z","updated_at":"2015-11-30T13:40:46Z","body":"Removing the ` [\"\"] ` stops it crashing but I don't know what the consequence of doing that is. The line would then be:\r\n    \r\n    @rolled_up_versions = @rolled_up_versions.where(\"#{Version.table_name}.id NOT IN (?)\", noperm + noallow)"}}