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

孫プロジェクト以降のバージョンも同時表示する機能を追加出来ませんか? #6

Open
yoshitake-hamano opened this issue Apr 6, 2012 · 0 comments

Comments

@yoshitake-hamano
Copy link

現在、子プロジェクトまでのバージョンを表示する仕様となっていますが、孫プロジェクト以降のバージョンも同時に表示出来るように変更できないでしょうか?

簡単にパッチを作成しましたのでご検討ください

動作確認環境:Redmine 1.3.1.devel.9126 (MySQL) (TRUNK)

※以下URLで書かれている通り、redmine trunkではrouteの設定を行わないと動作しませんが、
別途設定して動作確認しています
#4


--- app/controllers/roadmaps_main_controller.rb (github)
+++ app/controllers/roadmaps_main_controller.rb (working copy)
@@ -19,27 +19,29 @@
     logger.debug("parent versions results = #{@results.size.to_s}")

     # 子プロジェクト
-    logger.debug("get versions from child project.")
-    projects = Project.find(:all, :conditions => ["parent_id = ?", @project.id])
-    unless projects.nil?
-      projects.each do |child_project|
-        versions = RoadmapsLogic.get_versions(child_project.id)
-        if versions
-          @results.concat(versions)
-        end
-      end
-    end
+    add_child_versions(@project.id, @results)

     @results = @results.sort{|aa, bb|
       aa.name <=> bb.name
     }

     logger.debug("child versions results = #{@results.size.to_s}")
-
   end

   def init
     @project_id = params[:project_id]
     @project = Project.find(@project_id)
   end
+
+  private
+  def add_child_versions(self_id, results)
+    children = Project.find(:all, :conditions => ["parent_id = ?", self_id])
+    unless children.nil?
+      children.each do |child|
+        versions = RoadmapsLogic.get_versions(child.id)
+        results.concat(versions) if versions
+        add_child_versions(child.id, results)
+      end
+    end
+  end
 end

// 浜野義丈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant