checkoff 0.46.0 → 0.46.1
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/config/definitions.rb +2 -2
- data/lib/checkoff/internal/search_url/date_param_converter.rb +4 -2
- data/lib/checkoff/my_tasks.rb +21 -2
- data/lib/checkoff/projects.rb +4 -2
- data/lib/checkoff/sections.rb +15 -6
- 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: 5a4be48acbc5f3ab9954ca8f7ec3ef64f1c629bfbc0015f158cde7a87fcc4049
|
4
|
+
data.tar.gz: 1824e5607d750cc1d9b2161dc897cd4a08fd90c27fea1c4cc7a5f19ee4e2c497
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ef67e1152d4399b8b507a6b6b6555f300ac83ffda4b998a8ae031ada997deabdd60974228db9cb01101bf319a3092a36fa259391c4fbdc6940266e1d53f923d
|
7
|
+
data.tar.gz: e04b024a9f4def03f62fb7a8b1498e53ed2d08cc53cff3a5b76bc7f16b6a20402a450704a7f782372b5f3438a7ecad063f1e7047b552d50a360fa7c5d1d60dbc
|
data/Gemfile.lock
CHANGED
data/config/definitions.rb
CHANGED
@@ -83,7 +83,7 @@
|
|
83
83
|
# # just because another object it is associated with (e.g. a subtask)
|
84
84
|
# # is modified. Actions that count as modifying the task include
|
85
85
|
# # assigning, renaming, completing, and adding stories.
|
86
|
-
# # @return [
|
86
|
+
# # @return [Enumerable<Asana::Resources::Task>]
|
87
87
|
# def find_all(assignee: nil, workspace: nil, project: nil, section: nil,
|
88
88
|
# tag: nil, user_task_list: nil, completed_since: nil,
|
89
89
|
# modified_since: nil, per_page: 20, options: {}); end
|
@@ -106,7 +106,7 @@
|
|
106
106
|
# class Section
|
107
107
|
# # @param project_gid [String]
|
108
108
|
# # @return [Enumerable<Asana::Resources::Section>]
|
109
|
-
# def get_sections_for_project(
|
109
|
+
# def get_sections_for_project(project_gid:, options: {}); end
|
110
110
|
# end
|
111
111
|
# class Project
|
112
112
|
# # Returns the compact project records for all projects in the workspace.
|
@@ -48,9 +48,11 @@ module Checkoff
|
|
48
48
|
|
49
49
|
# @return [void]
|
50
50
|
def validate_due_date_through_next!
|
51
|
-
|
51
|
+
due_date_operators = date_url_params.fetch('due_date.operator')
|
52
52
|
|
53
|
-
|
53
|
+
return if due_date_operators == ['through_next']
|
54
|
+
|
55
|
+
raise "Teach me how to handle date mode: #{due_date_operators}."
|
54
56
|
end
|
55
57
|
|
56
58
|
# @return [Hash<String, Array<String>>]
|
data/lib/checkoff/my_tasks.rb
CHANGED
@@ -12,8 +12,12 @@ module Checkoff
|
|
12
12
|
LONG_CACHE_TIME = MINUTE * 15
|
13
13
|
SHORT_CACHE_TIME = MINUTE * 5
|
14
14
|
|
15
|
+
# @return [Checkoff::Projects]
|
15
16
|
attr_reader :projects
|
16
17
|
|
18
|
+
# @param config [Hash<Symbol, Object>]
|
19
|
+
# @param client [Asana::Client]
|
20
|
+
# @param projects [Checkoff::Projects]
|
17
21
|
def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
|
18
22
|
client: Checkoff::Clients.new(config: config).client,
|
19
23
|
projects: Checkoff::Projects.new(config: config,
|
@@ -26,13 +30,23 @@ module Checkoff
|
|
26
30
|
# Given a 'My Tasks' project object, pull all tasks, then provide
|
27
31
|
# a Hash of tasks with section name -> task list of the
|
28
32
|
# uncompleted tasks.
|
29
|
-
|
33
|
+
#
|
34
|
+
# @param project [Asana::Resources::Project]
|
35
|
+
# @param only_uncompleted [Boolean]
|
36
|
+
# @param extra_fields [Array<String>]
|
37
|
+
# @return [Hash<String, Enumerable<Asana::Resources::Task>>]
|
38
|
+
def tasks_by_section_for_my_tasks(project,
|
39
|
+
only_uncompleted: true,
|
40
|
+
extra_fields: [])
|
30
41
|
raw_tasks = projects.tasks_from_project(project,
|
42
|
+
only_uncompleted: only_uncompleted,
|
31
43
|
extra_fields: extra_fields + ['assignee_section.name'])
|
32
44
|
active_tasks = projects.active_tasks(raw_tasks)
|
33
45
|
by_my_tasks_section(active_tasks, project.gid)
|
34
46
|
end
|
35
47
|
|
48
|
+
# @param name [String]
|
49
|
+
# @return [String, nil]
|
36
50
|
def section_key(name)
|
37
51
|
return nil if name == 'Recently assigned'
|
38
52
|
|
@@ -41,10 +55,14 @@ module Checkoff
|
|
41
55
|
|
42
56
|
# Given a list of tasks in 'My Tasks', pull a Hash of tasks with
|
43
57
|
# section name -> task list
|
58
|
+
#
|
59
|
+
# @param tasks [Enumerable<Asana::Resources::Task>]
|
60
|
+
# @param project_gid [String]
|
61
|
+
# @return [Hash<String, Enumerable<Asana::Resources::Task>>]
|
44
62
|
def by_my_tasks_section(tasks, project_gid)
|
45
63
|
by_section = {}
|
46
64
|
sections = client.sections.get_sections_for_project(project_gid: project_gid)
|
47
|
-
sections.
|
65
|
+
sections.each_entry { |section| by_section[section_key(section.name)] = [] }
|
48
66
|
tasks.each do |task|
|
49
67
|
assignee_section = task.assignee_section
|
50
68
|
current_section = section_key(assignee_section.name)
|
@@ -56,6 +74,7 @@ module Checkoff
|
|
56
74
|
|
57
75
|
private
|
58
76
|
|
77
|
+
# @return [Asana::Client]
|
59
78
|
attr_reader :client
|
60
79
|
end
|
61
80
|
end
|
data/lib/checkoff/projects.rb
CHANGED
@@ -91,12 +91,14 @@ module Checkoff
|
|
91
91
|
# @param [Boolean] only_uncompleted
|
92
92
|
# @param [Array<String>] extra_fields
|
93
93
|
# @return [Enumerable<Asana::Resources::Task>]
|
94
|
-
def tasks_from_project(project,
|
94
|
+
def tasks_from_project(project,
|
95
|
+
only_uncompleted: true,
|
96
|
+
extra_fields: [])
|
95
97
|
options = task_options
|
96
98
|
options[:completed_since] = '9999-12-01' if only_uncompleted
|
97
99
|
options[:project] = project.gid
|
98
100
|
options[:options][:fields] += extra_fields
|
99
|
-
client.tasks.find_all(**options)
|
101
|
+
client.tasks.find_all(**options)
|
100
102
|
end
|
101
103
|
cache_method :tasks_from_project, SHORT_CACHE_TIME
|
102
104
|
|
data/lib/checkoff/sections.rb
CHANGED
@@ -65,17 +65,21 @@ module Checkoff
|
|
65
65
|
# tasks with section name -> task list of the uncompleted tasks
|
66
66
|
# @param workspace_name [String]
|
67
67
|
# @param project_name [String, Symbol]
|
68
|
+
# @param only_uncompleted [Boolean]
|
68
69
|
# @param extra_fields [Array<String>]
|
69
70
|
# @return [Hash{[String, nil] => Enumerable<Asana::Resources::Task>}]
|
70
|
-
def tasks_by_section(workspace_name,
|
71
|
+
def tasks_by_section(workspace_name,
|
72
|
+
project_name,
|
73
|
+
only_uncompleted: true,
|
74
|
+
extra_fields: [])
|
71
75
|
raise ArgumentError, 'Provided nil workspace name' if workspace_name.nil?
|
72
76
|
raise ArgumentError, 'Provided nil project name' if project_name.nil?
|
73
77
|
|
74
78
|
project = project_or_raise(workspace_name, project_name)
|
75
79
|
if project_name == :my_tasks
|
76
|
-
my_tasks.tasks_by_section_for_my_tasks(project, extra_fields: extra_fields)
|
80
|
+
my_tasks.tasks_by_section_for_my_tasks(project, only_uncompleted: only_uncompleted, extra_fields: extra_fields)
|
77
81
|
else
|
78
|
-
tasks_by_section_for_project(project, extra_fields: extra_fields)
|
82
|
+
tasks_by_section_for_project(project, only_uncompleted: only_uncompleted, extra_fields: extra_fields)
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
@@ -140,10 +144,15 @@ module Checkoff
|
|
140
144
|
# Given a project object, pull all tasks, then provide a Hash of
|
141
145
|
# tasks with section name -> task list of the uncompleted tasks
|
142
146
|
# @param project [Asana::Resources::Project]
|
147
|
+
# @param only_uncompleted [Boolean]
|
143
148
|
# @param extra_fields [Array<String>]
|
144
149
|
# @return [Hash<[String,nil], Enumerable<Asana::Resources::Task>>]
|
145
|
-
def tasks_by_section_for_project(project,
|
146
|
-
|
150
|
+
def tasks_by_section_for_project(project,
|
151
|
+
only_uncompleted: true,
|
152
|
+
extra_fields: [])
|
153
|
+
raw_tasks = projects.tasks_from_project(project,
|
154
|
+
only_uncompleted: only_uncompleted,
|
155
|
+
extra_fields: extra_fields)
|
147
156
|
active_tasks = projects.active_tasks(raw_tasks)
|
148
157
|
by_section(active_tasks, project.gid)
|
149
158
|
end
|
@@ -165,7 +174,7 @@ module Checkoff
|
|
165
174
|
by_section = {}
|
166
175
|
# @sg-ignore
|
167
176
|
sections = client.sections.get_sections_for_project(project_gid: project_gid)
|
168
|
-
sections.
|
177
|
+
sections.each_entry { |section| by_section[section_key(section.name)] = [] }
|
169
178
|
tasks.each { |task| file_task_by_section(by_section, task, project_gid) }
|
170
179
|
by_section
|
171
180
|
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.46.
|
4
|
+
version: 0.46.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-09-
|
11
|
+
date: 2023-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|