checkoff 0.148.0 → 0.149.0
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/tasks.rb +33 -8
- data/lib/checkoff/timelines.rb +3 -1
- data/lib/checkoff/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d22e09a2b3d0e47fa0eebca1c5484aa916327cf014caa2f5a5491c66791aa607
|
|
4
|
+
data.tar.gz: aa50373ee49bf7c70f0930fbd8480670bb395ebf760e27309c3dbcfd692ff22d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f855008ebd7d20737f7d4e8771796f67c6c86ab0fb991e83469caca6de5bb3fac634c97edbd0b6728ae4c9191c979a75d91722f6729b74eb1318bb4ed293eabb
|
|
7
|
+
data.tar.gz: 2bcdb1624b4bf845a61b6ac920277cccd13960212c5ce956fb02d304a9ef5a85110e9bf0f5ffb9d7bd1cdc0630b8caa7275a2ec28b95e858deab5c724514fdac
|
data/Gemfile.lock
CHANGED
data/lib/checkoff/tasks.rb
CHANGED
|
@@ -8,6 +8,7 @@ require_relative 'workspaces'
|
|
|
8
8
|
require_relative 'internal/config_loader'
|
|
9
9
|
require_relative 'internal/task_timing'
|
|
10
10
|
require_relative 'internal/task_hashes'
|
|
11
|
+
require_relative 'internal/logging'
|
|
11
12
|
require 'asana'
|
|
12
13
|
|
|
13
14
|
module Checkoff
|
|
@@ -16,6 +17,8 @@ module Checkoff
|
|
|
16
17
|
# @!parse
|
|
17
18
|
# extend CacheMethod::ClassMethods
|
|
18
19
|
|
|
20
|
+
include Logging
|
|
21
|
+
|
|
19
22
|
MINUTE = 60
|
|
20
23
|
HOUR = MINUTE * 60
|
|
21
24
|
DAY = 24 * HOUR
|
|
@@ -167,6 +170,8 @@ module Checkoff
|
|
|
167
170
|
|
|
168
171
|
# True if any of the task's dependencies are marked incomplete
|
|
169
172
|
#
|
|
173
|
+
# Include 'dependencies.gid' in extra_fields of task passed in.
|
|
174
|
+
#
|
|
170
175
|
# @param task [Asana::Resources::Task]
|
|
171
176
|
def incomplete_dependencies?(task)
|
|
172
177
|
# Avoid a redundant fetch. Unfortunately, Ruby SDK allows
|
|
@@ -179,8 +184,7 @@ module Checkoff
|
|
|
179
184
|
|
|
180
185
|
# @sg-ignore
|
|
181
186
|
# @type [Enumerable<Asana::Resources::Task>, nil]
|
|
182
|
-
dependencies = task.instance_variable_get(:@dependencies)
|
|
183
|
-
dependencies = task.dependencies.map { |dependency| { 'gid' => dependency.gid } } if dependencies.nil?
|
|
187
|
+
dependencies = task.instance_variable_get(:@dependencies) || []
|
|
184
188
|
|
|
185
189
|
dependencies.any? do |parent_task_info|
|
|
186
190
|
# the real bummer though is that asana doesn't let you fetch
|
|
@@ -188,20 +192,36 @@ module Checkoff
|
|
|
188
192
|
# regardless:
|
|
189
193
|
parent_task_gid = parent_task_info.fetch('gid')
|
|
190
194
|
|
|
191
|
-
parent_task = task_by_gid(parent_task_gid,
|
|
192
|
-
only_uncompleted: false)
|
|
195
|
+
parent_task = task_by_gid(parent_task_gid, only_uncompleted: false)
|
|
193
196
|
parent_task.completed_at.nil?
|
|
194
197
|
end
|
|
195
198
|
end
|
|
196
199
|
|
|
197
200
|
# @param task [Asana::Resources::Task]
|
|
198
201
|
#
|
|
199
|
-
# @return [Array<
|
|
202
|
+
# @return [Array<Hash>]
|
|
200
203
|
def all_dependent_tasks(task)
|
|
201
204
|
dependent_tasks = []
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
# See note above - same applies as does in @dependencies
|
|
206
|
+
#
|
|
207
|
+
# @type [Array<Hash>]
|
|
208
|
+
dependents = task.instance_variable_get(:@dependents) || []
|
|
209
|
+
dependents.each do |dependent_task_hash_or_obj|
|
|
210
|
+
# seems like if we ever .inspect the task, it stashes the task
|
|
211
|
+
# object instead of the hash. Try to avoid this - but maybe we
|
|
212
|
+
# need to convert if it does happen.
|
|
213
|
+
raise 'Found dependent task object!' if dependent_task_hash_or_obj.is_a?(Asana::Resources::Task)
|
|
214
|
+
|
|
215
|
+
dependent_task_hash = dependent_task_hash_or_obj
|
|
216
|
+
|
|
217
|
+
dependent_task = task_by_gid(dependent_task_hash.fetch('gid'),
|
|
218
|
+
only_uncompleted: true,
|
|
219
|
+
extra_fields: ['dependents'])
|
|
220
|
+
debug { "#{task.name} has dependent task #{dependent_task.name}" }
|
|
221
|
+
unless dependent_task.nil?
|
|
222
|
+
dependent_tasks << dependent_task
|
|
223
|
+
dependent_tasks += all_dependent_tasks(dependent_task)
|
|
224
|
+
end
|
|
205
225
|
end
|
|
206
226
|
dependent_tasks
|
|
207
227
|
end
|
|
@@ -248,6 +268,11 @@ module Checkoff
|
|
|
248
268
|
end
|
|
249
269
|
end
|
|
250
270
|
|
|
271
|
+
# @return [Hash]
|
|
272
|
+
def as_cache_key
|
|
273
|
+
{}
|
|
274
|
+
end
|
|
275
|
+
|
|
251
276
|
private
|
|
252
277
|
|
|
253
278
|
# @return [Checkoff::Internal::TaskTiming]
|
data/lib/checkoff/timelines.rb
CHANGED
|
@@ -69,7 +69,7 @@ module Checkoff
|
|
|
69
69
|
limit_to_portfolio_name)
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
all_dependent_task_gids =
|
|
72
|
+
all_dependent_task_gids = nil
|
|
73
73
|
task.memberships.all? do |membership_data|
|
|
74
74
|
unless limit_to_portfolio_name.nil?
|
|
75
75
|
project_gid = membership_data.fetch('project').fetch('gid')
|
|
@@ -86,6 +86,8 @@ module Checkoff
|
|
|
86
86
|
|
|
87
87
|
next true if last_milestone.gid == task.gid
|
|
88
88
|
|
|
89
|
+
all_dependent_task_gids ||= @tasks.all_dependent_tasks(task).map(&:gid)
|
|
90
|
+
|
|
89
91
|
all_dependent_task_gids.include? last_milestone.gid
|
|
90
92
|
end
|
|
91
93
|
end
|
data/lib/checkoff/version.rb
CHANGED