helena_administration 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6431e28f4dea66ec502020cb526e6767a8d15e93
|
4
|
+
data.tar.gz: 56d003fec38acf09a3de1975ed9a77c84daab7aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf0febd446ecafdf5b91a26c7b5a90e84a86932bc985d210cd89f6c270e8648097bf1df16813e62ae580a97b2aaabd94f1ff9fe306ebaaaa21164a5811af705c
|
7
|
+
data.tar.gz: 0f5edbf76ebee2bdbeea48b148f70bee1a72e6b73c8f061f7b062bc61150dceac27628c56a59c3cd4f72aff03d54d54d0ce2b63a737837fb26adb17326256cdf
|
data/Gemfile.lock
CHANGED
@@ -92,7 +92,7 @@ module HelenaAdministration
|
|
92
92
|
|
93
93
|
# It could be possible that an answer code equals a session field. We add "answer_" in that case so that we get uniqe question codes for sure
|
94
94
|
def unique_question_codes
|
95
|
-
codes = @survey.versions.map(&:question_codes).flatten
|
95
|
+
codes = @survey.versions.map(&:question_codes).flatten.uniq
|
96
96
|
codes.map do |code|
|
97
97
|
session_fields.include?(code) ? "answer_#{code}" : code
|
98
98
|
end
|
@@ -91,4 +91,29 @@ describe HelenaAdministration::SessionsController do
|
|
91
91
|
expect(csv.first).to include code
|
92
92
|
end
|
93
93
|
end
|
94
|
+
|
95
|
+
it 'only includes a column name once in a csv header' do
|
96
|
+
question_group.questions.create code: 'bla', question_text: 'from first version', _type: Helena::Questions::LongText
|
97
|
+
|
98
|
+
new_version = survey.versions.create version: 1
|
99
|
+
new_question_group = new_version.question_groups.create title: 'Abakadabara'
|
100
|
+
|
101
|
+
new_question_group.questions.create code: 'bla', question_text: 'from second version', _type: Helena::Questions::LongText
|
102
|
+
new_question_group.questions.create code: 'bli', question_text: 'something else', _type: Helena::Questions::ShortText
|
103
|
+
|
104
|
+
create :session, survey: survey, version: version, answers: [
|
105
|
+
build(:string_answer, code: 'bla', value: 'xxx')
|
106
|
+
]
|
107
|
+
create :session, survey: survey, version: new_version, answers: [
|
108
|
+
build(:string_answer, code: 'bla', value: 'yyy'),
|
109
|
+
build(:string_answer, code: 'bli', value: 'asdfasdfasdf')
|
110
|
+
]
|
111
|
+
get :index, survey_id: survey, format: :csv
|
112
|
+
|
113
|
+
csv = CSV.parse(response.body)
|
114
|
+
|
115
|
+
amount_of_blas_in_header = csv.first.count { |code| code == 'bla' }
|
116
|
+
|
117
|
+
expect(amount_of_blas_in_header).to eq 1
|
118
|
+
end
|
94
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helena_administration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Graf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kaminari
|