checkoff 0.148.0 → 0.150.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/projects.rb +9 -6
- data/lib/checkoff/tasks.rb +33 -8
- data/lib/checkoff/timelines.rb +3 -1
- 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: ff26e842716595b6b388bce568c5e65646535aa4ea7a88db6e375da53b0dd108
|
4
|
+
data.tar.gz: c7195465fa94bea1970610c90314a966cea5523fcd285693a5f66c4906d1a818
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd5fec3fc1dfe9e9237fb887fc069f783ed1d321c96e0ff5a031d9e377a7d34d27c06f385884062a0f11284f96d5b88e50c9ab9dc82e570805136a902f864120
|
7
|
+
data.tar.gz: 24fbfffbf84845740afa19d6d4634d4deff06e86b9eadd23b1e978fb5a7be785c504e5cfab668903e0acfecb6454dc1d5c8c7fb75c604b3dfe3cb023746af0de
|
data/Gemfile.lock
CHANGED
data/lib/checkoff/projects.rb
CHANGED
@@ -80,7 +80,7 @@ module Checkoff
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
83
|
-
cache_method :project,
|
83
|
+
cache_method :project, REALLY_LONG_CACHE_TIME
|
84
84
|
|
85
85
|
# @param workspace_name [String]
|
86
86
|
# @param project_name [String,Symbol<:my_tasks>]
|
@@ -93,7 +93,7 @@ module Checkoff
|
|
93
93
|
|
94
94
|
p
|
95
95
|
end
|
96
|
-
cache_method :project_or_raise,
|
96
|
+
cache_method :project_or_raise, REALLY_LONG_CACHE_TIME
|
97
97
|
|
98
98
|
# @param gid [String]
|
99
99
|
# @param [Array<String>] extra_fields
|
@@ -102,7 +102,7 @@ module Checkoff
|
|
102
102
|
def project_by_gid(gid, extra_fields: [])
|
103
103
|
projects.find_by_id(gid, options: { fields: %w[name] + extra_fields })
|
104
104
|
end
|
105
|
-
cache_method :project_by_gid,
|
105
|
+
cache_method :project_by_gid, REALLY_LONG_CACHE_TIME
|
106
106
|
|
107
107
|
# find uncompleted tasks in a list
|
108
108
|
# @param [Enumerable<Asana::Resources::Task>] tasks
|
@@ -133,10 +133,12 @@ module Checkoff
|
|
133
133
|
def projects_by_workspace_name(workspace_name, extra_fields: [])
|
134
134
|
workspace = @workspaces.workspace_or_raise(workspace_name)
|
135
135
|
options = { fields: %w[name] + extra_fields }
|
136
|
-
|
136
|
+
# 15 minute cache resulted in 'Your pagination token has
|
137
|
+
# expired', so let's cache this a super long time and force
|
138
|
+
# evaluation
|
139
|
+
projects.find_by_workspace(workspace: workspace.gid, per_page: 100, options: options).to_a
|
137
140
|
end
|
138
|
-
|
139
|
-
cache_method :projects_by_workspace_name, MEDIUM_CACHE_TIME
|
141
|
+
cache_method :projects_by_workspace_name, REALLY_LONG_CACHE_TIME
|
140
142
|
|
141
143
|
# @param project_obj [Asana::Resources::Project]
|
142
144
|
# @param project [String, Symbol<:not_specified, :my_tasks>]
|
@@ -190,6 +192,7 @@ module Checkoff
|
|
190
192
|
cache_method :projects, LONG_CACHE_TIME
|
191
193
|
|
192
194
|
# @param [String] workspace_name
|
195
|
+
#
|
193
196
|
# @return [Asana::Resources::Project]
|
194
197
|
def my_tasks(workspace_name)
|
195
198
|
workspace = @workspaces.workspace_or_raise(workspace_name)
|
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
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.150.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-12-
|
11
|
+
date: 2023-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|