surveyor 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.6
1
+ 0.9.7
@@ -93,7 +93,7 @@ class ResponseSet < ActiveRecord::Base
93
93
  responses.all?(&:correct?)
94
94
  end
95
95
  def correctness_hash
96
- { :questions => @survey.sections_with_questions.map(&:questions).flatten.compact.size,
96
+ { :questions => survey.sections_with_questions.map(&:questions).flatten.compact.size,
97
97
  :responses => responses.compact.size,
98
98
  :correct => responses.find_all(&:correct?).compact.size
99
99
  }
@@ -102,7 +102,7 @@ class ResponseSet < ActiveRecord::Base
102
102
  progress_hash[:triggered_mandatory] == progress_hash[:triggered_mandatory_completed]
103
103
  end
104
104
  def progress_hash
105
- qs = @survey.sections_with_questions.map(&:questions).flatten
105
+ qs = survey.sections_with_questions.map(&:questions).flatten
106
106
  ds = dependencies(qs.map(&:id))
107
107
  triggered = qs - ds.select{|d| !d.is_met?(self)}.map(&:question)
108
108
  { :questions => qs.compact.size,
data/lib/surveyor.rb CHANGED
@@ -1,9 +1,4 @@
1
- dir = File.dirname(__FILE__)
2
- $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
3
-
4
- require 'surveyor/config'
5
- require 'surveyor/acts_as_response'
6
-
1
+ require File.dirname(__FILE__) + '/surveyor/acts_as_response'
7
2
  module Surveyor
8
3
  RAND_CHARS = [('a'..'z'), ('A'..'Z'), (0..9)].map{|r| r.to_a}.flatten.to_s
9
4
 
@@ -25,4 +20,18 @@ module Surveyor
25
20
  cols = (col_text.split(' ') - words_to_omit)
26
21
  (cols.size > 5 ? cols[-5..-1] : cols).join("_")
27
22
  end
28
- end
23
+ end
24
+
25
+ # From http://guides.rubyonrails.org/plugins.html#controllers
26
+ # Fix for:
27
+ # ArgumentError in SurveyorController#edit
28
+ # A copy of ApplicationController has been removed from the module tree but is still active!
29
+ # Equivalent of using "unloadable" in SurveyorController (unloadable has been deprecated)
30
+
31
+ %w{models controllers}.each do |dir|
32
+ path = File.expand_path(File.join(File.dirname(__FILE__), '../app', dir))
33
+ # $LOAD_PATH << path # already here
34
+ # ActiveSupport::Dependencies.load_paths << path # already here too
35
+ ActiveSupport::Dependencies.load_once_paths.delete(path)
36
+ # [$LOAD_PATH, ActiveSupport::Dependencies.load_paths, ActiveSupport::Dependencies.load_once_paths].each{|x| Rails.logger.info x}
37
+ end
@@ -190,7 +190,7 @@ describe ResponseSet, "with mandatory, dependent questions" do
190
190
  count.times do |i|
191
191
  q = Factory(:question, :survey_section => @section, :is_mandatory => (mandatory == "mandatory"))
192
192
  a = Factory(:answer, :question => q, :response_class => "answer")
193
- if dependent = "dependent"
193
+ if dependent == "dependent"
194
194
  d = Factory(:dependency, :question => q)
195
195
  dc = Factory(:dependency_condition, :dependency => d, :question_id => dq.id, :answer_id => da.id)
196
196
  end
data/surveyor.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{surveyor}
8
- s.version = "0.9.6"
8
+ s.version = "0.9.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Chamberlain", "Mark Yoon"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surveyor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Chamberlain