experimental 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/experimental/experiment.rb +13 -0
- data/lib/experimental/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6f19002ed06a98a4c9631cc51015526b03f9667
|
4
|
+
data.tar.gz: 9c317be06e52f75e66958a7a1ddf57659cf542dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23a6c14d60ff60c92a5f40e2db007e4ebf8b65b48867e28afd77611b66724f52f3d6c8fdc98f57ba87aaadbb3bdf35652754123d7df835e3f58c7b723fcd31e1
|
7
|
+
data.tar.gz: 80792907f97d4d5d62a31ef7eb5ada47834c1af1f24a0098ae5bc8443b08b1c810647860092ad0b466f082c00bb91561b9c531b9060a32a7f149e7d82bbae0ff
|
@@ -4,12 +4,14 @@ module Experimental
|
|
4
4
|
|
5
5
|
attr_accessible :name, :num_buckets, :notes, :population
|
6
6
|
|
7
|
+
|
7
8
|
validates_presence_of :name, :num_buckets
|
8
9
|
validates_numericality_of :num_buckets, :greater_than_or_equal_to => 1
|
9
10
|
validates_numericality_of :winning_bucket,
|
10
11
|
:greater_than_or_equal_to => 0,
|
11
12
|
:less_than => :num_buckets,
|
12
13
|
:if => :ended?
|
14
|
+
validate :has_valid_dates
|
13
15
|
|
14
16
|
def self.in_code
|
15
17
|
where(:removed_at => nil)
|
@@ -115,6 +117,17 @@ module Experimental
|
|
115
117
|
|
116
118
|
private
|
117
119
|
|
120
|
+
def has_valid_dates
|
121
|
+
%w(start_date end_date).each do |attribute|
|
122
|
+
value = read_attribute_before_type_cast(attribute)
|
123
|
+
begin
|
124
|
+
value.try(:to_time)
|
125
|
+
rescue ArgumentError
|
126
|
+
errors.add(attribute, "is not a valid date")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
118
131
|
def population_filter
|
119
132
|
@population_filter ||= self.class.find_population(population)
|
120
133
|
end
|
data/lib/experimental/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: experimental
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HowAboutWe.com
|
8
8
|
- Rebecca Miller-Webster
|
9
9
|
- Bryan Woods
|
10
|
+
- Andrew Watkins
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2014-
|
14
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rails
|