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

fix SQL error in scheduled_vs_spent_time #3

Merged
merged 1 commit into from Jul 6, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/my/blocks/_scheduled_vs_spent_time.html.erb
Expand Up @@ -25,7 +25,7 @@
sql << " GROUP BY project_id, date"
sql << ") AS results"
sql << " LEFT JOIN #{Project.table_name} AS p ON p.id = results.project_id"
sql << " GROUP BY project_id"
sql << " GROUP BY p.id, p.name"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both p.id and p.name must be in the GROUP BY to allow them to be in the SELECT directly

this_day = ActiveRecord::Base.connection.select_all(sql % [date_on, date_on, date_on, date_on]).index_by { |x| x["id"].to_i }
this_week = ActiveRecord::Base.connection.select_all(sql % [week_from, week_to, week_from, week_to]).index_by { |x| x["id"].to_i }
this_month = ActiveRecord::Base.connection.select_all(sql % [month_from, month_to, month_from, month_to]).index_by { |x| x["id"].to_i }
Expand Down