Skip to content

Commit

Permalink
Fixing routing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbeattie committed Mar 12, 2009
1 parent f81d0d5 commit 826d297
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/controllers/graphs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class GraphsController < ApplicationController

before_filter :find_version, :only => [:target_version_graph]
before_filter :find_open_issues, :only => [:old_issues, :issue_age_graph]
before_filter :find_optional_project, :only => [:issue_growth_graph]
before_filter :find_optional_project, :only => [:issue_growth, :issue_growth_graph]

helper IssuesHelper

Expand Down Expand Up @@ -37,6 +37,7 @@ def issue_growth_graph
sql << " FROM issues"
sql << " LEFT JOIN #{Project.table_name} ON #{Issue.table_name}.project_id = #{Project.table_name}.id"
sql << " WHERE (%s)" % Project.allowed_to_condition(User.current, :view_issues)
sql << " AND (project_id = #{@project.id})" unless @project.nil?
sql << " GROUP BY project_id"
sql << " ORDER BY issue_count DESC"
sql << " LIMIT 6"
Expand All @@ -46,7 +47,6 @@ def issue_growth_graph
sql = "SELECT project_id, date(#{Issue.table_name}.created_on) as date, COUNT(*) as issue_count"
sql << " FROM #{Issue.table_name}"
sql << " WHERE project_id IN (%s)" % top_projects.compact.join(',')
sql << " AND (project_id = #{@project.id})" unless @project.nil?
sql << " GROUP BY project_id, date"
issue_counts = ActiveRecord::Base.connection.select_all(sql).group_by { |c| c["project_id"] }

Expand Down
4 changes: 3 additions & 1 deletion routes.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
map.connect 'projects/:project_id/issues/old', :controller => 'graphs', :action => 'old_issues'
map.connect 'issues/old', :controller => 'graphs', :action => 'old_issues'
map.connect 'issues/old', :controller => 'graphs', :action => 'old_issues'
map.connect 'projects/:project_id/issues/growth', :controller => 'graphs', :action => 'issue_growth'
map.connect 'issues/growth', :controller => 'graphs', :action => 'issue_growth'

0 comments on commit 826d297

Please sign in to comment.