checkoff 0.31.0 → 0.32.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/my_tasks.rb +19 -4
- data/lib/checkoff/sections.rb +14 -11
- 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: 318fa6ab4d3237eb9eaf57d752ba2ef13e0082a4d2d7656069fb58b1b2011165
|
4
|
+
data.tar.gz: 0c7f23448c07873c281a1b6cc93719df9d0e3ef952d5b43f6bc947ad5a0ca491
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bd96a96a0306d78c0b88f37aaa705a8d0d9c9552f35159bd70d2a3bfcbd84308903ce772c92c399d229cad9b21165ad751bfab269f6539bd3435a3ccfa20640
|
7
|
+
data.tar.gz: 1de9712b43b014a0c0103af61807c6ecf9d17df2ed961b12577ec5b9df6d4e486801f73a302563648da6b1deb42923bbffb59c11def81ea371782e66ffa55a64
|
data/Gemfile.lock
CHANGED
data/lib/checkoff/my_tasks.rb
CHANGED
@@ -15,8 +15,11 @@ module Checkoff
|
|
15
15
|
attr_reader :projects
|
16
16
|
|
17
17
|
def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
|
18
|
-
|
18
|
+
client: Checkoff::Clients.new(config: config).client,
|
19
|
+
projects: Checkoff::Projects.new(config: config,
|
20
|
+
client: client))
|
19
21
|
@config = config
|
22
|
+
@client = client
|
20
23
|
@projects = projects
|
21
24
|
end
|
22
25
|
|
@@ -27,20 +30,32 @@ module Checkoff
|
|
27
30
|
raw_tasks = projects.tasks_from_project(project,
|
28
31
|
extra_fields: extra_fields + ['assignee_section.name'])
|
29
32
|
active_tasks = projects.active_tasks(raw_tasks)
|
30
|
-
by_my_tasks_section(active_tasks)
|
33
|
+
by_my_tasks_section(active_tasks, project.gid)
|
34
|
+
end
|
35
|
+
|
36
|
+
def section_key(name)
|
37
|
+
return nil if name == 'Recently assigned'
|
38
|
+
|
39
|
+
name
|
31
40
|
end
|
32
41
|
|
33
42
|
# Given a list of tasks in 'My Tasks', pull a Hash of tasks with
|
34
43
|
# section name -> task list
|
35
|
-
def by_my_tasks_section(tasks)
|
44
|
+
def by_my_tasks_section(tasks, project_gid)
|
36
45
|
by_section = {}
|
46
|
+
sections = client.sections.get_sections_for_project(project_gid: project_gid)
|
47
|
+
sections.each { |section| by_section[section_key(section.name)] = [] }
|
37
48
|
tasks.each do |task|
|
38
49
|
assignee_section = task.assignee_section
|
39
|
-
current_section = assignee_section.name
|
50
|
+
current_section = section_key(assignee_section.name)
|
40
51
|
by_section[current_section] ||= []
|
41
52
|
by_section[current_section] << task
|
42
53
|
end
|
43
54
|
by_section
|
44
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
attr_reader :client
|
45
60
|
end
|
46
61
|
end
|
data/lib/checkoff/sections.rb
CHANGED
@@ -26,7 +26,7 @@ module Checkoff
|
|
26
26
|
time: Time)
|
27
27
|
@projects = projects
|
28
28
|
@workspaces = workspaces
|
29
|
-
@my_tasks = Checkoff::MyTasks.new(config: config, projects: projects)
|
29
|
+
@my_tasks = Checkoff::MyTasks.new(config: config, projects: projects, client: client)
|
30
30
|
@client = client
|
31
31
|
@time = time
|
32
32
|
end
|
@@ -89,19 +89,24 @@ module Checkoff
|
|
89
89
|
# Given a project object, pull all tasks, then provide a Hash of
|
90
90
|
# tasks with section name -> task list of the uncompleted tasks
|
91
91
|
def tasks_by_section_for_project(project, extra_fields: [])
|
92
|
-
# print("project: #{project}")
|
93
92
|
raw_tasks = projects.tasks_from_project(project, extra_fields: extra_fields)
|
94
|
-
# print("raw_tasks[0]: #{raw_tasks[0]}")
|
95
93
|
active_tasks = projects.active_tasks(raw_tasks)
|
96
94
|
by_section(active_tasks, project.gid)
|
97
95
|
end
|
98
96
|
|
97
|
+
def section_key(name)
|
98
|
+
inbox_section_names = ['(no section)', 'Untitled section', 'Inbox']
|
99
|
+
return nil if inbox_section_names.include?(name)
|
100
|
+
|
101
|
+
name
|
102
|
+
end
|
103
|
+
|
99
104
|
# Given a list of tasks, pull a Hash of tasks with section name -> task list
|
100
105
|
def by_section(tasks, project_gid)
|
101
106
|
by_section = {}
|
102
|
-
|
103
|
-
|
104
|
-
|
107
|
+
sections = client.sections.get_sections_for_project(project_gid: project_gid)
|
108
|
+
sections.each { |section| by_section[section_key(section.name)] = [] }
|
109
|
+
tasks.each { |task| file_task_by_section(by_section, task, project_gid) }
|
105
110
|
by_section
|
106
111
|
end
|
107
112
|
cache_method :by_section, LONG_CACHE_TIME
|
@@ -110,11 +115,9 @@ module Checkoff
|
|
110
115
|
membership = task.memberships.find { |m| m['project']['gid'] == project_gid }
|
111
116
|
raise "Could not find task in project_gid #{project_gid}: #{task}" if membership.nil?
|
112
117
|
|
113
|
-
current_section = membership['section']['name']
|
114
|
-
|
115
|
-
|
116
|
-
by_section[current_section] ||= []
|
117
|
-
by_section[current_section] << task
|
118
|
+
current_section = section_key(membership['section']['name'])
|
119
|
+
|
120
|
+
by_section.fetch(current_section) << task
|
118
121
|
end
|
119
122
|
|
120
123
|
def project_or_raise(workspace_name, project_name)
|
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.32.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-02-
|
11
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|