##// END OF EJS Templates
Replaces camelcase variable names (#14015)....
Jean-Philippe Lang -
r11598:8c9bba1cbfe4
parent child
Show More
@@ -854,10 +854,8 class Issue < ActiveRecord::Base
854 854 end
855 855
856 856 # Returns all the other issues that depend on the issue
857 # The algorithm is a modified breadth first search (bfs)
857 858 def all_dependent_issues(except=[])
858
859 # The algorithm as a modified bread first search (bfs)
860
861 859 # The found dependencies
862 860 dependencies = []
863 861
@@ -879,77 +877,77 class Issue < ActiveRecord::Base
879 877 eALL_PROCESSED = 5 # The issue and all its children, its parent and its related issues have been
880 878 # added as dependent issues. It needs no further processing.
881 879
882 issueStatus = Hash.new(eNOT_DISCOVERED)
880 issue_status = Hash.new(eNOT_DISCOVERED)
883 881
884 882 # The queue
885 883 queue = []
886 884
887 885 # Initialize the bfs, add start node (self) to the queue
888 886 queue << self
889 issueStatus[self] = ePROCESS_ALL
887 issue_status[self] = ePROCESS_ALL
890 888
891 889 while (!queue.empty?) do
892 890
893 currentIssue = queue.shift
894 currentIssueStatus = issueStatus[currentIssue]
891 current_issue = queue.shift
892 current_issue_status = issue_status[current_issue]
895 893
896 dependencies << currentIssue
894 dependencies << current_issue
897 895
898 896 # Add parent to queue, if not already in it.
899 parent = currentIssue.parent
900 parentStatus = issueStatus[parent]
897 parent = current_issue.parent
898 parentStatus = issue_status[parent]
901 899
902 900 if parent && (parentStatus == eNOT_DISCOVERED) && !except.include?(parent) then
903 901
904 902 queue << parent
905 issueStatus[parent] = ePROCESS_RELATIONS_ONLY
903 issue_status[parent] = ePROCESS_RELATIONS_ONLY
906 904
907 905 end
908 906
909 907 # Add children to queue, but only if they are not already in it and
910 908 # the children of the current node need to be processed.
911 if currentIssue.children && (currentIssueStatus == ePROCESS_CHILDREN_ONLY || currentIssueStatus == ePROCESS_ALL) then
909 if current_issue.children && (current_issue_status == ePROCESS_CHILDREN_ONLY || current_issue_status == ePROCESS_ALL) then
912 910
913 currentIssue.children.each do |child|
911 current_issue.children.each do |child|
914 912
915 if (issueStatus[child] == eNOT_DISCOVERED) && !except.include?(child)
913 if (issue_status[child] == eNOT_DISCOVERED) && !except.include?(child)
916 914 queue << child
917 issueStatus[child] = ePROCESS_ALL
915 issue_status[child] = ePROCESS_ALL
918 916
919 elsif (issueStatus[child] == eRELATIONS_PROCESSED) && !except.include?(child)
917 elsif (issue_status[child] == eRELATIONS_PROCESSED) && !except.include?(child)
920 918 queue << child
921 issueStatus[child] = ePROCESS_CHILDREN_ONLY
919 issue_status[child] = ePROCESS_CHILDREN_ONLY
922 920
923 elsif (issueStatus[child] == ePROCESS_RELATIONS_ONLY) && !except.include?(child)
921 elsif (issue_status[child] == ePROCESS_RELATIONS_ONLY) && !except.include?(child)
924 922 queue << child
925 issueStatus[child] = ePROCESS_ALL
923 issue_status[child] = ePROCESS_ALL
926 924 end
927 925 end
928 926 end
929 927
930 928 # Add related issues to the queue, if they are not already in it.
931 currentIssue.relations_from.map(&:issue_to).each do |relatedIssue|
929 current_issue.relations_from.map(&:issue_to).each do |relatedIssue|
932 930
933 if (issueStatus[relatedIssue] == eNOT_DISCOVERED) && !except.include?(relatedIssue) then
931 if (issue_status[relatedIssue] == eNOT_DISCOVERED) && !except.include?(relatedIssue) then
934 932 queue << relatedIssue
935 issueStatus[relatedIssue] = ePROCESS_ALL
933 issue_status[relatedIssue] = ePROCESS_ALL
936 934
937 elsif (issueStatus[relatedIssue] == eRELATIONS_PROCESSED) && !except.include?(relatedIssue) then
935 elsif (issue_status[relatedIssue] == eRELATIONS_PROCESSED) && !except.include?(relatedIssue) then
938 936 queue << relatedIssue
939 issueStatus[relatedIssue] = ePROCESS_CHILDREN_ONLY
937 issue_status[relatedIssue] = ePROCESS_CHILDREN_ONLY
940 938
941 elsif (issueStatus[relatedIssue] == ePROCESS_RELATIONS_ONLY) && !except.include?(relatedIssue) then
939 elsif (issue_status[relatedIssue] == ePROCESS_RELATIONS_ONLY) && !except.include?(relatedIssue) then
942 940 queue << relatedIssue
943 issueStatus[relatedIssue] = ePROCESS_ALL
941 issue_status[relatedIssue] = ePROCESS_ALL
944 942 end
945 943 end
946 944
947 945 # Set new status for current issue
948 if (currentIssueStatus == ePROCESS_ALL) || (currentIssueStatus == ePROCESS_CHILDREN_ONLY) then
949 issueStatus[currentIssue] = eALL_PROCESSED
946 if (current_issue_status == ePROCESS_ALL) || (current_issue_status == ePROCESS_CHILDREN_ONLY) then
947 issue_status[current_issue] = eALL_PROCESSED
950 948
951 elsif (currentIssueStatus == ePROCESS_RELATIONS_ONLY) then
952 issueStatus[currentIssue] = eRELATIONS_PROCESSED
949 elsif (current_issue_status == ePROCESS_RELATIONS_ONLY) then
950 issue_status[current_issue] = eRELATIONS_PROCESSED
953 951 end
954 952
955 953 end # while
General Comments 0
You need to be logged in to leave comments. Login now