checkoff 0.25.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/checkoff/internal/search_url/custom_field_param_converter.rb +9 -6
- data/lib/checkoff/internal/search_url/custom_field_variant.rb +9 -2
- data/lib/checkoff/internal/task_selector_evaluator.rb +44 -14
- data/lib/checkoff/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10a2b886559bd9a77cdf03a309825250a99c4e03c251f0c1699b9941aef09e30
|
4
|
+
data.tar.gz: cab6c6505b28ee63b79c8b6765efc2401d10f4d4ec53b6b86791283a87f5a065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e170ab3b7c20cdf9ccb0f6fc89df6277c5bebecaa1da242f58ddeab3dbedc955e097307ad23c11b88d368ae8aeb5fa73e6c0584a05aeaa335232ec753b7235b7
|
7
|
+
data.tar.gz: 6ff4dcbeeaa90e46fa67578c44ce68f790de5569b5a3a19c6d7ebf3a9181aa566921b31f4a9afb0504292a274ce4e51c0b5cb0a8480d0be75b435493f4a687dc
|
data/Gemfile.lock
CHANGED
@@ -33,14 +33,17 @@ module Checkoff
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def merge_args_and_task_selectors(args, new_args, task_selector, new_task_selector)
|
36
|
-
|
37
|
-
return [args, task_selector] if new_task_selector == []
|
36
|
+
final_args = args.merge(new_args)
|
38
37
|
|
39
|
-
|
38
|
+
final_task_selector = if new_task_selector == []
|
39
|
+
task_selector
|
40
|
+
elsif task_selector == []
|
41
|
+
new_task_selector
|
42
|
+
else
|
43
|
+
[:and, task_selector, new_task_selector]
|
44
|
+
end
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
[args, task_selector]
|
46
|
+
[final_args, final_task_selector]
|
44
47
|
end
|
45
48
|
|
46
49
|
VARIANTS = {
|
@@ -100,8 +100,15 @@ module Checkoff
|
|
100
100
|
raise "Teach me how to handle these remaining keys for #{variant_key}: #{remaining_params}"
|
101
101
|
end
|
102
102
|
|
103
|
-
|
104
|
-
|
103
|
+
api_params = { "custom_fields.#{gid}.is_set" => 'false' }
|
104
|
+
# As of 2023-02, the 'is_set' => 'false' seems to not do
|
105
|
+
# the intuitive thing on multi-select fields; it either
|
106
|
+
# operates as a no-op or operates the same as 'true'; not
|
107
|
+
# sure.
|
108
|
+
#
|
109
|
+
# Let's handle those with a filter afterwards.
|
110
|
+
task_selector = [:nil?, [:custom_field_gid_value, gid]]
|
111
|
+
[api_params, task_selector]
|
105
112
|
end
|
106
113
|
end
|
107
114
|
|
@@ -17,9 +17,35 @@ module Checkoff
|
|
17
17
|
object.is_a?(Array) && !object.empty? && [fn_name, fn_name.to_s].include?(object[0])
|
18
18
|
end
|
19
19
|
|
20
|
+
def pull_custom_field_or_raise(task, custom_field_gid)
|
21
|
+
custom_fields = task.custom_fields
|
22
|
+
if custom_fields.nil?
|
23
|
+
raise "Could not find custom_fields under task (was 'custom_fields' included in 'extra_fields'?)"
|
24
|
+
end
|
25
|
+
|
26
|
+
matched_custom_field = custom_fields.find { |data| data.fetch('gid') == custom_field_gid }
|
27
|
+
if matched_custom_field.nil?
|
28
|
+
raise "Could not find custom field with gid #{custom_field_gid} " \
|
29
|
+
"in task #{task.gid} with custom fields #{custom_fields}"
|
30
|
+
end
|
31
|
+
|
32
|
+
matched_custom_field
|
33
|
+
end
|
34
|
+
|
20
35
|
attr_reader :task_selector
|
21
36
|
end
|
22
37
|
|
38
|
+
# :and function
|
39
|
+
class AndFunctionEvaluator < FunctionEvaluator
|
40
|
+
def matches?
|
41
|
+
fn?(task_selector, :and)
|
42
|
+
end
|
43
|
+
|
44
|
+
def evaluate(_task, lhs, rhs)
|
45
|
+
lhs && rhs
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
23
49
|
# :not function
|
24
50
|
class NotFunctionEvaluator < FunctionEvaluator
|
25
51
|
def matches?
|
@@ -80,6 +106,22 @@ module Checkoff
|
|
80
106
|
end
|
81
107
|
end
|
82
108
|
|
109
|
+
# :custom_field_gid_value function
|
110
|
+
class CustomFieldGidValueFunctionEvaluator < FunctionEvaluator
|
111
|
+
def matches?
|
112
|
+
fn?(task_selector, :custom_field_gid_value)
|
113
|
+
end
|
114
|
+
|
115
|
+
def evaluate_arg?(_index)
|
116
|
+
false
|
117
|
+
end
|
118
|
+
|
119
|
+
def evaluate(task, custom_field_gid)
|
120
|
+
custom_field = pull_custom_field_or_raise(task, custom_field_gid)
|
121
|
+
custom_field['display_value']
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
83
125
|
# :custom_field_gid_value_contains_any_gid function
|
84
126
|
class CustomFieldGidValueContainsAnyGidFunctionEvaluator < FunctionEvaluator
|
85
127
|
def matches?
|
@@ -98,20 +140,6 @@ module Checkoff
|
|
98
140
|
|
99
141
|
private
|
100
142
|
|
101
|
-
def pull_custom_field_or_raise(task, custom_field_gid)
|
102
|
-
custom_fields = task.custom_fields
|
103
|
-
if custom_fields.nil?
|
104
|
-
raise "Could not find custom_fields under task (was 'custom_fields' included in 'extra_fields'?)"
|
105
|
-
end
|
106
|
-
|
107
|
-
matched_custom_field = custom_fields.find { |data| data.fetch('gid') == custom_field_gid }
|
108
|
-
if matched_custom_field.nil?
|
109
|
-
raise "Could not find custom field with gid #{custom_field_gid} in #{task.gid} with #{custom_fields}"
|
110
|
-
end
|
111
|
-
|
112
|
-
matched_custom_field
|
113
|
-
end
|
114
|
-
|
115
143
|
def pull_enum_values(custom_field)
|
116
144
|
resource_subtype = custom_field.fetch('resource_subtype')
|
117
145
|
case resource_subtype
|
@@ -153,7 +181,9 @@ module Checkoff
|
|
153
181
|
NilPFunctionEvaluator,
|
154
182
|
TagPFunctionEvaluator,
|
155
183
|
CustomFieldValueFunctionEvaluator,
|
184
|
+
CustomFieldGidValueFunctionEvaluator,
|
156
185
|
CustomFieldGidValueContainsAnyGidFunctionEvaluator,
|
186
|
+
AndFunctionEvaluator,
|
157
187
|
].freeze
|
158
188
|
|
159
189
|
def evaluate(task_selector)
|
data/lib/checkoff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkoff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.26.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vince Broz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|