active_record_survey 0.1.46 → 0.1.47
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db7d02e98f6dcacb15e74ed15c1694adb8d7b989
|
4
|
+
data.tar.gz: 21d3f34d72bd909c9cc7b0f55bb01bf426174668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2f1460b9b14f498ea85882f229cc0f36d824f9e1bfbb41855fe908b59e91ac1b90ac76b69063b6ffcc47489eb0efe982e08d6f736a44813e344afdf399575c5
|
7
|
+
data.tar.gz: 3a14f13f378178a83eb06328d6de351851430c32605e74043445035b9fc08e7153cc327893737effc140a58a758059b9d74183186da7fd10dc16b3805fa7230c
|
@@ -91,18 +91,19 @@ module ActiveRecordSurvey
|
|
91
91
|
|
92
92
|
# Gets index in sibling relationship
|
93
93
|
def sibling_index
|
94
|
-
|
95
|
-
|
96
|
-
}.first
|
94
|
+
node_maps = self.survey.node_maps.includes(:node, parent: [:node])
|
95
|
+
|
96
|
+
if node_map = node_maps.select { |i| i.node == self }.first
|
97
|
+
parent = node_map.parent
|
97
98
|
|
98
|
-
|
99
|
+
children = node_maps.select { |i| i.parent && i.parent.node === parent.node }
|
100
|
+
|
101
|
+
children.each_with_index { |nm, i|
|
99
102
|
if nm == node_map
|
100
103
|
return i
|
101
104
|
end
|
102
105
|
}
|
103
106
|
end
|
104
|
-
|
105
|
-
return 0
|
106
107
|
end
|
107
108
|
|
108
109
|
def sibling_index=index
|
@@ -160,7 +160,7 @@ describe ActiveRecordSurvey::Node::Question, :question_spec => true do
|
|
160
160
|
}
|
161
161
|
end
|
162
162
|
end
|
163
|
-
describe "advanced case"
|
163
|
+
describe "advanced case" do
|
164
164
|
before(:each) do
|
165
165
|
@survey = FactoryGirl.build(:basic_survey2)
|
166
166
|
@survey.save
|