helena_administration 0.0.7 → 0.1.0

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: 391f02ca9affd5e425a3b93049571953c81fe82a
4
- data.tar.gz: 2dd700e9b728188290d743c7c6a8d8b27b0a7aa7
3
+ metadata.gz: 7be513ec2267b6335e0f51c946d1776b6a4e5995
4
+ data.tar.gz: 5e3461b71bfd28bf5d8757a83d798ecc1452c0a0
5
5
  SHA512:
6
- metadata.gz: 7702d987b2478b3ed6554dafd139f62d2fa835ec4189f852e2e15be56dc24f198de0a573391bcc4b416702f44bdab249ab676b600ee0a218d9e895270fac6f69
7
- data.tar.gz: dcc02084894d9026305e3d550c261e04e337600fbde02c6f7e4beb99181513aa1b16348fc7444d8f21889786a2377b39f0d88dc6d5f29cc5d347d4692a4d069c
6
+ metadata.gz: b6dfbf876750414e6619017e7bad58abeeef46244c64ade522c9e0180537904e64a5a0d715530e8c9cca67a416ac46c743a5cf101a2432e0551459fcb29e706b
7
+ data.tar.gz: 143a094be49257991abf317e3c2c11fd8b66f957969b73cc5b0a412d64b2b2847c24102861c6c56cd26359fc98050dff7a6590dbeb5d731d3c3625168f31aaa9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- helena_administration (0.0.7)
4
+ helena_administration (0.1.0)
5
5
  bootstrap-sass (~> 3.2)
6
6
  breadcrumbs_on_rails (~> 2.3)
7
7
  codemirror-rails (~> 5)
@@ -54,7 +54,7 @@ module HelenaAdministration
54
54
 
55
55
  # .. and generate a line for each session.
56
56
  @sessions.each do |session|
57
- response.stream.write CSV.generate_line(session_values(session) + [session.version.version] + answer_values(session, question_codes))
57
+ response.stream.write CSV.generate_line(session_values(session) + [session.version.version] + answer_values(session))
58
58
  end
59
59
  ensure
60
60
  response.stream.close
@@ -64,8 +64,9 @@ module HelenaAdministration
64
64
  session_fields.map { |field| session.attributes[field] }
65
65
  end
66
66
 
67
- def answer_values(session, answer_codes)
68
- answer_codes.map { |code| session.answers.where(code: code).first.try(&:value) }
67
+ def answer_values(session)
68
+ answers = Hash[session.answers.map { |answer| [answer.code, answer.value] }]
69
+ question_codes.map { |code| answers[code] }
69
70
  end
70
71
 
71
72
  def add_breadcrumbs
@@ -98,7 +99,7 @@ module HelenaAdministration
98
99
  end
99
100
 
100
101
  def session_fields
101
- Helena::Session.fields.keys
102
+ @session_fields ||= Helena::Session.fields.keys
102
103
  end
103
104
  end
104
105
  end
@@ -1,3 +1,3 @@
1
1
  module HelenaAdministration
2
- VERSION = '0.0.7'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helena_administration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Graf