checkoff 0.65.0 → 0.66.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc25937a7534eda70c7729a9844ef9a8d9dd5443f91a90272a0071558255b369
|
4
|
+
data.tar.gz: 380cb06602f7b984f60ad18fa095ccc69e1f3df67273ee09c6a7eff862879d45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5de5eb2dc6849012b9440fb583186a83d7a1123d2d77f254f293be3158c509ea947ae54386510f6b75957f90dd1d664248b8716122c8a8ea744e6216b96d7204
|
7
|
+
data.tar.gz: '088c35ad378b6e2fc57196e58e8071b5814a59c6fe680fdb96212a6571a7de09b497235eeacb048e824a337b5e05f57698417f3864d4670c9a8dd255dace68fa'
|
data/Gemfile.lock
CHANGED
@@ -51,6 +51,7 @@ module Checkoff
|
|
51
51
|
'is_not' => CustomFieldVariant::IsNot,
|
52
52
|
'less_than' => CustomFieldVariant::LessThan,
|
53
53
|
'greater_than' => CustomFieldVariant::GreaterThan,
|
54
|
+
'equals' => CustomFieldVariant::Equals,
|
54
55
|
'doesnt_contain_any' => CustomFieldVariant::DoesntContainAny,
|
55
56
|
'contains_any' => CustomFieldVariant::ContainsAny,
|
56
57
|
'contains_all' => CustomFieldVariant::ContainsAll,
|
@@ -7,6 +7,8 @@ module Checkoff
|
|
7
7
|
module CustomFieldVariant
|
8
8
|
# base class for handling different custom_field_#{gid}.variant params
|
9
9
|
class CustomFieldVariant
|
10
|
+
# @param [String] gid
|
11
|
+
# @param [Hash] remaining_params
|
10
12
|
def initialize(gid, remaining_params)
|
11
13
|
@gid = gid
|
12
14
|
@remaining_params = remaining_params
|
@@ -14,17 +16,27 @@ module Checkoff
|
|
14
16
|
|
15
17
|
private
|
16
18
|
|
17
|
-
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :gid
|
18
21
|
|
22
|
+
# @return [Hash]
|
23
|
+
attr_reader :remaining_params
|
24
|
+
|
25
|
+
# @return [void]
|
19
26
|
def ensure_no_remaining_params!
|
20
27
|
return if remaining_params.empty?
|
21
28
|
|
22
29
|
raise "Teach me how to handle these remaining keys: #{remaining_params}"
|
23
30
|
end
|
24
31
|
|
32
|
+
# @param [String] param_name
|
33
|
+
#
|
34
|
+
# @return [String]
|
25
35
|
def fetch_solo_param(param_name)
|
26
36
|
case remaining_params.keys
|
27
37
|
when [param_name]
|
38
|
+
# @sg-ignore
|
39
|
+
# @type [Array<String>]
|
28
40
|
param_values = remaining_params.fetch(param_name)
|
29
41
|
unless param_values.length == 1
|
30
42
|
raise "Teach me how to handle these remaining keys for #{param_name}: #{remaining_params}"
|
@@ -39,6 +51,7 @@ module Checkoff
|
|
39
51
|
|
40
52
|
# custom_field_#{gid}.variant = 'less_than'
|
41
53
|
class LessThan < CustomFieldVariant
|
54
|
+
# @return [Array<(Hash, Array)>]
|
42
55
|
def convert
|
43
56
|
max_value = fetch_solo_param("custom_field_#{gid}.max")
|
44
57
|
empty_task_selector = []
|
@@ -48,6 +61,7 @@ module Checkoff
|
|
48
61
|
|
49
62
|
# custom_field_#{gid}.variant = 'greater_than'
|
50
63
|
class GreaterThan < CustomFieldVariant
|
64
|
+
# @return [Array<(Hash, Array)>]
|
51
65
|
def convert
|
52
66
|
max_value = fetch_solo_param("custom_field_#{gid}.min")
|
53
67
|
empty_task_selector = []
|
@@ -55,10 +69,21 @@ module Checkoff
|
|
55
69
|
end
|
56
70
|
end
|
57
71
|
|
72
|
+
# custom_field_#{gid}.variant = 'equals'
|
73
|
+
class Equals < CustomFieldVariant
|
74
|
+
# @return [Array<(Hash, Array)>]
|
75
|
+
def convert
|
76
|
+
value = fetch_solo_param("custom_field_#{gid}.value")
|
77
|
+
empty_task_selector = []
|
78
|
+
[{ "custom_fields.#{gid}.value" => value }, empty_task_selector]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
58
82
|
# This is used in the UI for select fields
|
59
83
|
#
|
60
84
|
# custom_field_#{gid}.variant = 'is_not'
|
61
85
|
class IsNot < CustomFieldVariant
|
86
|
+
# @return [Array<(Hash, Array)>]
|
62
87
|
def convert
|
63
88
|
selected_options = fetch_solo_param("custom_field_#{gid}.selected_options").split('~')
|
64
89
|
|
@@ -75,6 +100,7 @@ module Checkoff
|
|
75
100
|
#
|
76
101
|
# custom_field_#{gid}.variant = 'doesnt_contain_any'
|
77
102
|
class DoesntContainAny < CustomFieldVariant
|
103
|
+
# @return [Array<(Hash, Array)>]
|
78
104
|
def convert
|
79
105
|
selected_options = fetch_solo_param("custom_field_#{gid}.selected_options").split('~')
|
80
106
|
|
@@ -90,6 +116,7 @@ module Checkoff
|
|
90
116
|
#
|
91
117
|
# custom_field_#{gid}.variant = 'contains_any'
|
92
118
|
class ContainsAny < CustomFieldVariant
|
119
|
+
# @return [Array<(Hash, Array)>]
|
93
120
|
def convert
|
94
121
|
selected_options = fetch_solo_param("custom_field_#{gid}.selected_options").split('~')
|
95
122
|
|
@@ -104,6 +131,7 @@ module Checkoff
|
|
104
131
|
#
|
105
132
|
# custom_field_#{gid}.variant = 'contains_all'
|
106
133
|
class ContainsAll < CustomFieldVariant
|
134
|
+
# @return [Array<(Hash, Array)>]
|
107
135
|
def convert
|
108
136
|
selected_options = fetch_solo_param("custom_field_#{gid}.selected_options").split('~')
|
109
137
|
|
@@ -116,6 +144,7 @@ module Checkoff
|
|
116
144
|
|
117
145
|
# custom_field_#{gid}.variant = 'no_value'
|
118
146
|
class NoValue < CustomFieldVariant
|
147
|
+
# @return [Array<(Hash, Array)>]
|
119
148
|
def convert
|
120
149
|
ensure_no_remaining_params!
|
121
150
|
|
@@ -135,6 +164,7 @@ module Checkoff
|
|
135
164
|
#
|
136
165
|
# Not used for multi-select fields
|
137
166
|
class AnyValue < CustomFieldVariant
|
167
|
+
# @return [Array<(Hash, Array)>]
|
138
168
|
def convert
|
139
169
|
ensure_no_remaining_params!
|
140
170
|
|
@@ -146,6 +176,7 @@ module Checkoff
|
|
146
176
|
|
147
177
|
# custom_field_#{gid}.variant = 'is'
|
148
178
|
class Is < CustomFieldVariant
|
179
|
+
# @return [Array<(Hash, Array)>]
|
149
180
|
def convert
|
150
181
|
selected_options = fetch_solo_param("custom_field_#{gid}.selected_options").split('~')
|
151
182
|
|
data/lib/checkoff/version.rb
CHANGED