eyp / redmine_spent_time

Redmine plugin that improves the spent time functionality.
Other
57 stars 39 forks source link

Error on SQL query for DB engines that use boolean instead of int for boolean values #93

Closed adrianobr closed 8 years ago

adrianobr commented 8 years ago

Error to opem spent_time: log production:

ActionView::Template::Error (PG::UndefinedFunction: ERROR: operator does not exist: boolean = integer LINE 1: ...me_entries.user_id=1) AND issue_statuses.is_closed=0 AND pro... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. : SELECT DISTINCT "issues".* FROM "issues" INNER JOIN "issue_statuses" ON "issue_statuses"."id" = "issues"."status_id" INNER JOIN "projects" ON "projects"."id" = "issues"."project_id" INNER JOIN "trackers" ON "trackers"."id" = "issues"."tracker_id" INNER JOIN "enumerations" ON "enumerations"."id" = "issues"."priority_id" AND "enumerations"."type" IN ('IssuePriority') LEFT JOIN time_entries ON time_entries.issue_id = issues.id WHERE ((issues.assigned_to_id=1 or time_entries.user_id=1) AND issue_statuses.is_closed=0 AND projects.status=1 AND projects.id=1) ORDER BY issues.id DESC, issues.updated_on DESC): 5: <%= select_tag('issue_id', "".html_safe) %> 6: <% else %> 7: <%= select_tag('issue_id', 8: options_for_select([[l(:select_issues_option), 0]] + @assigned_issues.collect { |i| ["##{i.id} - #{i.subject}".html_safe, i.id] }), :style => 'width:250px') %> 9: <% end -%> 10: <%= l(:label_date) %> 11: <%= text_field_tag('time_entry_spent_on', if (Date.today >= @from && Date.today <= @to) then Date.today else '' end, :size => 10) %> <%= calendar_for('time_entry_spent_on') %> plugins/redmine_spent_time/app/views/spent_time/_fields_for_new_entry_form.html.erb:8:in _plugins_redmine_spent_time_app_views_spent_time__fields_for_new_entry_form_html_erb___1932477833778798918_41833840' plugins/redmine_workflow_enhancements/lib/workflow_enhancements/patches/action_view_rendering.rb:53:inrender_with_workflow_enhancements' plugins/redmine_spent_time/app/views/spent_time/_new_time_entry_form.html.erb:14:in block in _plugins_redmine_spent_time_app_views_spent_time__new_time_entry_form_html_erb___2867132386747570199_32872600' plugins/redmine_spent_time/app/views/spent_time/_new_time_entry_form.html.erb:4:in_plugins_redmine_spent_time_app_views_spent_timenew_time_entry_form_htmlerb2867132386747570199_32872600' plugins/redmine_workflow_enhancements/lib/workflow_enhancements/patches/action_view_rendering.rb:53:in render_with_workflow_enhancements' plugins/redmine_spent_time/app/views/spent_time/index.html.erb:28:in_plugins_redmine_spent_time_app_views_spent_time_index_html_erb__4237520158231585936_111191900' lib/redmine/sudo_mode.rb:63:in `sudo_mode'

adrianobr commented 8 years ago

Help?

eyp commented 8 years ago

Hi, I think the problem is the last commit I did. Some databases need 0 instead of false on boolean fields... While I find a good solution for this, try changing the file ' app/helpers/spent_time_helper.rb ' line 16 from 0 to false: https://github.com/eyp/redmine_spent_time/commit/964cedae5700536f98fd2649826b80c3c3e087e5

adrianobr commented 8 years ago

Yes, is solved! Integrated in branch master?

eyp commented 8 years ago

Yes, it's in master