alexmonteiro / Redmine-Monitoring-Controlling

Redmine Plugin that works with Highcharts to show tasks on project throught Charts.
Other
132 stars 77 forks source link

Subprojects bug and patch #89

Open oyvjel opened 11 years ago

oyvjel commented 11 years ago

Version redmine_monitoring_controlling 0.1.1 ( 0.1.2 in README)

When there are no issues in a master project with subprojects containing issues a "no issues found" error is rendered. Workaround: Define an issue (closed) directly in the top-level project.

or apply this patch:

diff --git a/app/controllers/home_monitoring_controlling_project_controller.rb b/app/controllers/home_monitoring_controlling_project
index b8fd12d..2e43fc1 100644
--- a/app/controllers/home_monitoring_controlling_project_controller.rb
+++ b/app/controllers/home_monitoring_controlling_project_controller.rb
@@ -19,7 +19,8 @@ class HomeMonitoringControllingProjectController < ApplicationController
     @all_project_issues = Issue.find_by_sql("select * from issues where project_id in (#{stringSqlProjectsSubProjects});")

     # total issues from the project and subprojects
-    @totalIssues = Issue.where(:project_id => [stringSqlProjectsSubProjects]).count
+#    @totalIssues = Issue.where(:project_id => [stringSqlProjectsSubProjects]).count
+    @totalIssues = @all_project_issues.count

     #get count of issues by category
     @issuesbycategory = IssueStatus.find_by_sql(["select trackers.name, trackers.position, count(*) as totalbycategory,
diff --git a/app/controllers/mc_human_resource_mgmt_project_controller.rb b/app/controllers/mc_human_resource_mgmt_project_controlle
index e95a9b5..41709ae 100644
--- a/app/controllers/mc_human_resource_mgmt_project_controller.rb
+++ b/app/controllers/mc_human_resource_mgmt_project_controller.rb
@@ -16,7 +16,9 @@ class McHumanResourceMgmtProjectController < ApplicationController
     stringSqlProjectsSubProjects = tool.return_ids(@project.id)    

     # total issues from the project and subprojects
-    @totalIssues = Issue.where(:project_id => [stringSqlProjectsSubProjects]).count
+#    @totalIssues = Issue.where(:project_id => [stringSqlProjectsSubProjects]).count
+    @all_project_issues = Issue.find_by_sql("select * from issues where project_id in (#{stringSqlProjectsSubProjects});")
+    @totalIssues = @all_project_issues.count

     @statusesByAssigneds = Issue.find_by_sql("select assigned_to_id, (select firstname from users where id = assigned_to_id) as ass
                                               issue_statuses.id, issue_statuses.name, 
Guite commented 11 years ago

Thanks for the patch :+1:

cforce commented 11 years ago

Why not an upstream pull request ..this is bad contributing, however tx for the patch

benoitlm commented 9 years ago

Thanks :+1: