checkoff 0.118.0 → 0.120.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 117e0d119a50af033c6f3b28fd27b12163547a3b236aa9ecc25440bc87f0107f
|
4
|
+
data.tar.gz: 1764ec654cb5b3d247a597c9630c0df5f5a94cca6614a6a914f5d293ba711ab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee2e30a3963d4ecb2677703a559c1e6452e40db3f55d536852f62a1d668f301df45e4ee584213124308063295628b28e0f10e7eaee9bdfb62846e8bf9d235fac
|
7
|
+
data.tar.gz: d2af0a7c6242e5a1b2e21582c354fbdc4596d63175aa2c0a59c27736a583c05b9bfeb852c212f7f82a7316908c2524edc20a51dab8566f40deaada016f40e061
|
data/Gemfile.lock
CHANGED
@@ -20,7 +20,7 @@ module Checkoff
|
|
20
20
|
|
21
21
|
out = nil
|
22
22
|
|
23
|
-
%w[due_date start_date].each do |prefix|
|
23
|
+
%w[due_date start_date completion_date].each do |prefix|
|
24
24
|
next unless date_url_params.key? "#{prefix}.operator"
|
25
25
|
raise 'Teach me how to handle simultaneous date parameters' unless out.nil?
|
26
26
|
|
@@ -44,10 +44,13 @@ module Checkoff
|
|
44
44
|
# due_date.unit=day
|
45
45
|
operator = get_single_param("#{prefix}.operator")
|
46
46
|
|
47
|
-
out =
|
47
|
+
out = case operator
|
48
|
+
when 'through_next'
|
48
49
|
handle_through_next(prefix)
|
49
|
-
|
50
|
+
when 'between'
|
50
51
|
handle_between(prefix)
|
52
|
+
when 'within_last'
|
53
|
+
handle_within_last(prefix)
|
51
54
|
else
|
52
55
|
raise "Teach me how to handle date mode: #{operator.inspect}."
|
53
56
|
end
|
@@ -62,6 +65,7 @@ module Checkoff
|
|
62
65
|
API_PREFIX = {
|
63
66
|
'due_date' => 'due_on',
|
64
67
|
'start_date' => 'start_on',
|
68
|
+
'completion_date' => 'completed_on',
|
65
69
|
}.freeze
|
66
70
|
|
67
71
|
# @param prefix [String]
|
@@ -97,6 +101,20 @@ module Checkoff
|
|
97
101
|
[{ "#{API_PREFIX.fetch(prefix)}.after" => after.to_s }, []]
|
98
102
|
end
|
99
103
|
|
104
|
+
# @param prefix [String]
|
105
|
+
# @return [Array(Hash<String, String>, Array<[Symbol, Array]>)] See https://developers.asana.com/docs/search-tasks-in-a-workspace
|
106
|
+
def handle_within_last(prefix)
|
107
|
+
value = get_single_param("#{prefix}.value").to_i
|
108
|
+
|
109
|
+
validate_unit_is_day!(prefix)
|
110
|
+
|
111
|
+
# @sg-ignore
|
112
|
+
# @type [Date]
|
113
|
+
after = Date.today - value
|
114
|
+
|
115
|
+
[{ "#{API_PREFIX.fetch(prefix)}.after" => after.to_s }, []]
|
116
|
+
end
|
117
|
+
|
100
118
|
# @param param_key [String]
|
101
119
|
# @return [String]
|
102
120
|
def get_single_param(param_key)
|
@@ -265,11 +265,17 @@ module Checkoff
|
|
265
265
|
fn?(selector, FUNCTION_NAME)
|
266
266
|
end
|
267
267
|
|
268
|
+
def evaluate_arg?(_index)
|
269
|
+
false
|
270
|
+
end
|
271
|
+
|
268
272
|
# @param task [Asana::Resources::Task]
|
273
|
+
# @param limit_to_portfolio_name [String, nil]
|
269
274
|
#
|
270
275
|
# @return [Boolean]
|
271
|
-
def evaluate(task)
|
272
|
-
!@timelines.last_task_milestone_depends_on_this_task?(task
|
276
|
+
def evaluate(task, limit_to_portfolio_name = nil)
|
277
|
+
!@timelines.last_task_milestone_depends_on_this_task?(task,
|
278
|
+
limit_to_portfolio_name: limit_to_portfolio_name)
|
273
279
|
end
|
274
280
|
end
|
275
281
|
end
|
data/lib/checkoff/timelines.rb
CHANGED
@@ -27,17 +27,20 @@ module Checkoff
|
|
27
27
|
# @param workspaces [Checkoff::Workspaces]
|
28
28
|
# @param sections [Checkoff::Sections]
|
29
29
|
# @param tasks [Checkoff::Tasks]
|
30
|
+
# @param portfolios [Checkoff::Portfolios]
|
30
31
|
# @param clients [Checkoff::Clients]
|
31
32
|
# @param client [Asana::Client]
|
32
33
|
def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
|
33
34
|
workspaces: Checkoff::Workspaces.new(config: config),
|
34
35
|
sections: Checkoff::Sections.new(config: config),
|
35
36
|
tasks: Checkoff::Tasks.new(config: config),
|
37
|
+
portfolios: Checkoff::Portfolios.new(config: config),
|
36
38
|
clients: Checkoff::Clients.new(config: config),
|
37
39
|
client: clients.client)
|
38
40
|
@workspaces = workspaces
|
39
41
|
@sections = sections
|
40
42
|
@tasks = tasks
|
43
|
+
@portfolios = portfolios
|
41
44
|
@client = client
|
42
45
|
end
|
43
46
|
|
@@ -59,9 +62,19 @@ module Checkoff
|
|
59
62
|
end
|
60
63
|
|
61
64
|
# @param task [Asana::Resources::Task]
|
62
|
-
|
65
|
+
# @param limit_to_portfolio_name [String, nil]
|
66
|
+
def last_task_milestone_depends_on_this_task?(task, limit_to_portfolio_name: nil)
|
67
|
+
unless limit_to_portfolio_name.nil?
|
68
|
+
limit_to_projects = @portfolios.projects_in_portfolio(@workspaces.default_workspace.name,
|
69
|
+
limit_to_portfolio_name)
|
70
|
+
end
|
71
|
+
|
63
72
|
all_dependent_task_gids = @tasks.all_dependent_tasks(task).map(&:gid)
|
64
73
|
task.memberships.all? do |membership_data|
|
74
|
+
unless limit_to_portfolio_name.nil?
|
75
|
+
project_gid = membership_data.fetch('project').fetch('gid')
|
76
|
+
next true if limit_to_projects.map(&:gid).include? project_gid
|
77
|
+
end
|
65
78
|
# @type [Hash{String => String}]
|
66
79
|
section_data = membership_data.fetch('section')
|
67
80
|
# @type [String]
|
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.120.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-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|