helena_administration 0.1.0 → 0.1.1

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: 7be513ec2267b6335e0f51c946d1776b6a4e5995
4
- data.tar.gz: 5e3461b71bfd28bf5d8757a83d798ecc1452c0a0
3
+ metadata.gz: 6431e28f4dea66ec502020cb526e6767a8d15e93
4
+ data.tar.gz: 56d003fec38acf09a3de1975ed9a77c84daab7aa
5
5
  SHA512:
6
- metadata.gz: b6dfbf876750414e6619017e7bad58abeeef46244c64ade522c9e0180537904e64a5a0d715530e8c9cca67a416ac46c743a5cf101a2432e0551459fcb29e706b
7
- data.tar.gz: 143a094be49257991abf317e3c2c11fd8b66f957969b73cc5b0a412d64b2b2847c24102861c6c56cd26359fc98050dff7a6590dbeb5d731d3c3625168f31aaa9
6
+ metadata.gz: cf0febd446ecafdf5b91a26c7b5a90e84a86932bc985d210cd89f6c270e8648097bf1df16813e62ae580a97b2aaabd94f1ff9fe306ebaaaa21164a5811af705c
7
+ data.tar.gz: 0f5edbf76ebee2bdbeea48b148f70bee1a72e6b73c8f061f7b062bc61150dceac27628c56a59c3cd4f72aff03d54d54d0ce2b63a737837fb26adb17326256cdf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- helena_administration (0.1.0)
4
+ helena_administration (0.1.1)
5
5
  bootstrap-sass (~> 3.2)
6
6
  breadcrumbs_on_rails (~> 2.3)
7
7
  codemirror-rails (~> 5)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module HelenaAdministration
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  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.0
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-07-24 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari