checkoff 0.116.0 → 0.117.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/internal/selector_classes/task.rb +16 -0
- data/lib/checkoff/tasks.rb +12 -0
- data/lib/checkoff/timelines.rb +19 -0
- 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: 45425d3f07cc0fc1bf0e39a56a2f26c8777622953a3a75ae9d32ed758d0301ce
|
4
|
+
data.tar.gz: 456407b377fe6286909c23a0728f0d6954982c53b714610b7bd393a812dd4bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 622c7e1b6bb0d0f18f104c8b6b3d94240242a0528f73fceadd592e546a38b4bf2e0c36726729ba4d4d558068a2d9b200cdd0e1b8e79c25710bd471f445936b20
|
7
|
+
data.tar.gz: 258d4c6fca76db0bdbd3a1acdb8280c536c7ae788b77c9dcd7b0c2002b78b270b61237cc2a99c503354eff6816e58fc3b4ffbd179ec17d6aa179db6f84eb0d89
|
data/Gemfile.lock
CHANGED
@@ -256,6 +256,22 @@ module Checkoff
|
|
256
256
|
@tasks.in_portfolio_named?(task, portfolio_name)
|
257
257
|
end
|
258
258
|
end
|
259
|
+
|
260
|
+
# :last_task_milestone_does_not_depend_on_this_task? function
|
261
|
+
class LastTaskMilestoneDoesNotDependOnThisTaskPFunctionEvaluator < FunctionEvaluator
|
262
|
+
FUNCTION_NAME = :last_task_milestone_does_not_depend_on_this_task?
|
263
|
+
|
264
|
+
def matches?
|
265
|
+
fn?(selector, FUNCTION_NAME)
|
266
|
+
end
|
267
|
+
|
268
|
+
# @param task [Asana::Resources::Task]
|
269
|
+
#
|
270
|
+
# @return [Boolean]
|
271
|
+
def evaluate(task)
|
272
|
+
!@timelines.last_task_milestone_depends_on_this_task?(task)
|
273
|
+
end
|
274
|
+
end
|
259
275
|
end
|
260
276
|
end
|
261
277
|
end
|
data/lib/checkoff/tasks.rb
CHANGED
@@ -188,6 +188,18 @@ module Checkoff
|
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
+
# @param task [Asana::Resources::Task]
|
192
|
+
#
|
193
|
+
# @return [Array<Asana::Resources::Task>]
|
194
|
+
def all_dependent_tasks(task)
|
195
|
+
dependent_tasks = []
|
196
|
+
task.dependents.each do |dependent_task|
|
197
|
+
dependent_tasks << dependent_task
|
198
|
+
dependent_tasks += all_dependent_tasks(dependent_task)
|
199
|
+
end
|
200
|
+
dependent_tasks
|
201
|
+
end
|
202
|
+
|
191
203
|
# Builds on the standard API representation of an Asana task with some
|
192
204
|
# convenience keys:
|
193
205
|
#
|
data/lib/checkoff/timelines.rb
CHANGED
@@ -58,6 +58,25 @@ module Checkoff
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
# @param task [Asana::Resources::Task]
|
62
|
+
def last_task_milestone_depends_on_this_task?(task)
|
63
|
+
all_dependent_task_gids = @tasks.all_dependent_tasks(task).map(&:gid)
|
64
|
+
task.memberships.all? do |membership_data|
|
65
|
+
# @type [Hash{String => String}]
|
66
|
+
section_data = membership_data.fetch('section')
|
67
|
+
# @type [String]
|
68
|
+
section_gid = section_data.fetch('gid')
|
69
|
+
|
70
|
+
last_milestone = last_milestone_in_section(section_gid)
|
71
|
+
|
72
|
+
next false if last_milestone.nil?
|
73
|
+
|
74
|
+
next true if last_milestone.gid == task.gid
|
75
|
+
|
76
|
+
all_dependent_task_gids.include? last_milestone.gid
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
61
80
|
# @param section_gid [String]
|
62
81
|
#
|
63
82
|
# @return [Asana::Resources::Task,nil]
|
data/lib/checkoff/version.rb
CHANGED