From d560e6a652401ddc377a27f87871f14a57dd9d46 Mon Sep 17 00:00:00 2001 From: "Alex T. Silverstein" Date: Wed, 16 Dec 2015 13:10:45 -0500 Subject: [PATCH] PostgreSQL/MySQL query syntax mods Changed date-related query syntax in variable "where_query" from PostgreSQL to MySQL --- app/controllers/worktimelog_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/worktimelog_controller.rb b/app/controllers/worktimelog_controller.rb index 8c3b085..d490d1f 100644 --- a/app/controllers/worktimelog_controller.rb +++ b/app/controllers/worktimelog_controller.rb @@ -64,7 +64,7 @@ def issue_summary where_query = "issue_id = #{params[:issue_id]} AND flag = 1" if (params[:started] && params[:finished]) - where_query += "AND (started, finished) OVERLAPS ('#{params[:started]}'::DATE, '#{params[:finished]}'::DATE)" + where_query += " AND (started >= '#{params[:started]}' AND finished <= '#{params[:finished]}')" end @summary = Worktimelog.joins([{issue: :project},:user]).select(' @@ -101,7 +101,7 @@ def project_summary where_query = "projects.identifier = '#{params[:project_id]}' AND flag = 1" if (params[:started] && params[:finished]) - where_query += "AND (started, finished) OVERLAPS ('#{params[:started]}'::DATE, '#{params[:finished]}'::DATE)" + where_query += " AND (started >= '#{params[:started]}' AND finished <= '#{params[:finished]}')" end @summary = Worktimelog.joins([{issue: :project},:user]).select(' @@ -135,8 +135,8 @@ def user_summary @date = Time.now @where_query = "user_id = #{params[:id]} AND flag = 1" @user = User.find(params[:id]) - if (params[:started] && params[:finished]) - @where_query += "AND (started, finished) OVERLAPS ('#{params[:started]}'::DATE, '#{params[:finished]}'::DATE)" + if (params[:started] && params[:finished]) + @where_query += " AND (started >= '#{params[:started]}' AND finished <= '#{params[:finished]}')" end @summary = Worktimelog.joins(issue: :project).select(' issue_id,