checkoff 0.46.1 → 0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/checkoff/internal/task_selector_evaluator.rb +40 -0
- 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: ceda0651cbf579c86f81e93c887531c64a3147519488daf1be6d11491e896bf9
|
4
|
+
data.tar.gz: 17c109b638773681a63b209ab74b82f6de4bba2962b2475ceac8305c426f14aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 183735480d70aef2cfb4a23bf0b37e18df9360208286bd16ff5fbbfe07dcb5447918cd0400604cb95cb0720b11322effee388af4c9b3832d92b06b6b5a400ac6
|
7
|
+
data.tar.gz: 3c93bb2a2182f53960e763fdab615741be3ec9fc7cfc383c907ef6adf09351fd4b000be9869d8bec37b2cf221c3d41aa52dc6714ed398fad11c90dfc558e95e1
|
data/Gemfile.lock
CHANGED
@@ -32,6 +32,17 @@ module Checkoff
|
|
32
32
|
object.is_a?(Array) && !object.empty? && [fn_name, fn_name.to_s].include?(object[0])
|
33
33
|
end
|
34
34
|
|
35
|
+
# @param task [Asana::Resources::Task]
|
36
|
+
# @param field_name [Symbol]
|
37
|
+
#
|
38
|
+
# @sg-ignore
|
39
|
+
# @return [Date, nil]
|
40
|
+
def pull_date_field_by_name_or_raise(task, field_name)
|
41
|
+
raise "Teach me how to handle field #{field_name}" unless field_name == :modified_at
|
42
|
+
|
43
|
+
task.modified_at
|
44
|
+
end
|
45
|
+
|
35
46
|
# @sg-ignore
|
36
47
|
# @param task [Asana::Resources::Task]
|
37
48
|
# @param custom_field_gid [String]
|
@@ -330,6 +341,34 @@ module Checkoff
|
|
330
341
|
end
|
331
342
|
end
|
332
343
|
|
344
|
+
# :field_less_than_n_days_ago
|
345
|
+
class FieldLessThanNDaysAgoFunctionEvaluator < FunctionEvaluator
|
346
|
+
FUNCTION_NAME = :field_less_than_n_days_ago
|
347
|
+
|
348
|
+
def matches?
|
349
|
+
fn?(task_selector, FUNCTION_NAME)
|
350
|
+
end
|
351
|
+
|
352
|
+
def evaluate_arg?(_index)
|
353
|
+
false
|
354
|
+
end
|
355
|
+
|
356
|
+
# @param task [Asana::Resources::Task]
|
357
|
+
# @param field_name [Symbol]
|
358
|
+
# @param num_days [Integer]
|
359
|
+
#
|
360
|
+
# @return [Boolean]
|
361
|
+
def evaluate(task, field_name, num_days)
|
362
|
+
time = pull_date_field_by_name_or_raise(task, field_name)
|
363
|
+
|
364
|
+
return false if time.nil?
|
365
|
+
|
366
|
+
n_days_ago = (Time.now - (num_days * 24 * 60 * 60))
|
367
|
+
# @sg-ignore
|
368
|
+
time < n_days_ago
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
333
372
|
# :custom_field_less_than_n_days_from_now function
|
334
373
|
class CustomFieldLessThanNDaysFromNowFunctionEvaluator < FunctionEvaluator
|
335
374
|
FUNCTION_NAME = :custom_field_less_than_n_days_from_now
|
@@ -427,6 +466,7 @@ module Checkoff
|
|
427
466
|
Checkoff::TaskSelectorClasses::AndFunctionEvaluator,
|
428
467
|
Checkoff::TaskSelectorClasses::DuePFunctionEvaluator,
|
429
468
|
Checkoff::TaskSelectorClasses::DueDateSetPFunctionEvaluator,
|
469
|
+
Checkoff::TaskSelectorClasses::FieldLessThanNDaysAgoFunctionEvaluator,
|
430
470
|
Checkoff::TaskSelectorClasses::CustomFieldLessThanNDaysFromNowFunctionEvaluator,
|
431
471
|
Checkoff::TaskSelectorClasses::CustomFieldGreaterThanOrEqualToNDaysFromNowFunctionEvaluator,
|
432
472
|
Checkoff::TaskSelectorClasses::StringLiteralEvaluator,
|
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.47.0
|
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-09-
|
11
|
+
date: 2023-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|