checkoff 0.44.6 → 0.45.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43ead734039a1e722f69f510a7c0b9597af3b8340902f539f04ec9bce19a9368
4
- data.tar.gz: 0c49dfc97a5d1b10039ce26b3a441fc61e9d83964930aac3b8d0ace856111ff3
3
+ metadata.gz: 166520f53086eea60a30deae24eacea2bff98b58cc63e1bc14397e016cfce5a3
4
+ data.tar.gz: 182f61588c6343c7b16100a56357909b5d1c532a2580040fdb50828dedeb4032
5
5
  SHA512:
6
- metadata.gz: '081cf0167a2983dbda34d3e6b2a00b948c073d98044fc9fef211640078344fbc34a54ad3b5a1b6c9863e50fe468baf63e769496ec7790462c04029b55059dace'
7
- data.tar.gz: 13d392146de29ef790980ea24ffc0d8511fbc5ffe05e7d9ba6c8c8dda880ad06b0b96014b565b8a5d355c71eaa1a302219749096d0bff20af1971f198d637034
6
+ metadata.gz: 00461660f5b2f2927d5c0bd89b34e12a1393ce105dcddf6782054ef655c3ba55654c0d5a818e35907dd46d457beac3a18b637bb2a5379ae78d30913fdd55944d
7
+ data.tar.gz: 8aa6bdc999894732e1e243cac1617b6b40b905b80562c5d8d57bbf2a988b4f1b66fc7848dbe4937dc01228c503a4e26661bc17a28c75c6effed5b10d9afd10db
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.44.6)
15
+ checkoff (0.45.1)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -22,7 +22,7 @@ PATH
22
22
  GEM
23
23
  remote: https://rubygems.org/
24
24
  specs:
25
- activesupport (7.0.6)
25
+ activesupport (7.0.7.2)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (>= 1.6, < 2)
28
28
  minitest (>= 5.1)
@@ -349,7 +349,11 @@ module Checkoff
349
349
  def evaluate(task, custom_field_name, num_days)
350
350
  custom_field = pull_custom_field_by_name_or_raise(task, custom_field_name)
351
351
 
352
+ # @sg-ignore
353
+ # @type [String, nil]
352
354
  time_str = custom_field.fetch('display_value')
355
+ return false if time_str.nil?
356
+
353
357
  time = Time.parse(time_str)
354
358
  n_days_from_now = (Time.now + (num_days * 24 * 60 * 60))
355
359
  time < n_days_from_now
@@ -375,7 +379,11 @@ module Checkoff
375
379
  def evaluate(task, custom_field_name, num_days)
376
380
  custom_field = pull_custom_field_by_name_or_raise(task, custom_field_name)
377
381
 
382
+ # @sg-ignore
383
+ # @type [String, nil]
378
384
  time_str = custom_field.fetch('display_value')
385
+ return false if time_str.nil?
386
+
379
387
  time = Time.parse(time_str)
380
388
  n_days_from_now = (Time.now + (num_days * 24 * 60 * 60))
381
389
  time >= n_days_from_now
@@ -429,10 +437,9 @@ module Checkoff
429
437
  def evaluate(task_selector)
430
438
  return true if task_selector.empty?
431
439
 
432
- # @param evaluator_class [Class<FunctionEvaluator>]
440
+ # @param evaluator_class [Class<TaskSelectorClasses::FunctionEvaluator>]
433
441
  FUNCTION_EVALUTORS.each do |evaluator_class|
434
442
  # @sg-ignore
435
- # @type [FunctionEvaluator]
436
443
  evaluator = evaluator_class.new(task_selector: task_selector,
437
444
  tasks: tasks)
438
445
 
@@ -448,7 +455,7 @@ module Checkoff
448
455
 
449
456
  # @sg-ignore
450
457
  # @param task_selector [Array]
451
- # @param evaluator [FunctionEvaluator]
458
+ # @param evaluator [TaskSelectorClasses::FunctionEvaluator]
452
459
  # @return [Boolean, Object, nil]
453
460
  def try_this_evaluator(task_selector, evaluator)
454
461
  # if task_selector is an array
@@ -39,13 +39,13 @@ module Checkoff
39
39
  @client = client
40
40
  end
41
41
 
42
- # Default options used in Asana API to pull taskso
42
+ # Default options used in Asana API to pull tasks
43
43
  # @return [Hash<Symbol, Object>]
44
44
  def task_options
45
45
  {
46
46
  per_page: 100,
47
47
  options: {
48
- fields: %w[name completed_at due_at due_on tags
48
+ fields: %w[name completed_at start_at start_on due_at due_on tags
49
49
  memberships.project.gid memberships.section.name dependencies],
50
50
  },
51
51
  }
@@ -44,11 +44,12 @@ module Checkoff
44
44
  def task_ready?(task, ignore_dependencies: false)
45
45
  return false if !ignore_dependencies && incomplete_dependencies?(task)
46
46
 
47
+ start = start_time(task)
47
48
  due = due_time(task)
48
49
 
49
- return true if due.nil?
50
+ return true if start.nil? && due.nil?
50
51
 
51
- due < @time_class.now
52
+ (start || due) < @time_class.now
52
53
  end
53
54
 
54
55
  # Pull a specific task by name
@@ -140,6 +141,15 @@ module Checkoff
140
141
  @config.fetch(:default_assignee_gid)
141
142
  end
142
143
 
144
+ # @param task [Asana::Resources::Task]
145
+ # @return [Time, nil]
146
+ def start_time(task)
147
+ return @time_class.parse(task.start_at) if task.start_at
148
+ return @time_class.parse(task.start_on) if task.start_on
149
+
150
+ nil
151
+ end
152
+
143
153
  # @param task [Asana::Resources::Task]
144
154
  # @return [Time, nil]
145
155
  def due_time(task)
@@ -3,5 +3,5 @@
3
3
  # Command-line and gem client for Asana (unofficial)
4
4
  module Checkoff
5
5
  # Version of library
6
- VERSION = '0.44.6'
6
+ VERSION = '0.45.1'
7
7
  end
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.44.6
4
+ version: 0.45.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-08-06 00:00:00.000000000 Z
11
+ date: 2023-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport