checkoff 0.4.0 → 0.5.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: abb481b28efc4dc6131fdc028fe0bffb8c441dc92c95474e23455f7a1fed8ede
4
- data.tar.gz: 98e270c7be0078e5efa19425affc4692c3343d093e5ab96d027eb5b643d8b141
3
+ metadata.gz: a75e010929b7dcb752bf9cffd0f424039cb4c54da94e44af30a8b8627f13eefb
4
+ data.tar.gz: f2410a5287cf99a90f23ed7052a18f09553a652b87b575a2b665e7717c0193fa
5
5
  SHA512:
6
- metadata.gz: 2c6ddd7d5092290e0fbc953274f98c2b0b68262aef2201a378fa71a947152ee3c0d331c730127e5ba05616e7e9afc3261324a5d0b6babbaf63c4bd96115fcfa2
7
- data.tar.gz: 3ba297866e0c3970e12a8f31b796359f58b93d02a2d7aae5aef04dd071e68a5d4d41a4c5c4e8b3ec5f38123b0f7072f1dd2ee98217fae9bd3d1a6fb2aa843012
6
+ metadata.gz: b7f458362faa147dc0c6d6097b4c3e912ce73c9a5de729fdfedd61bb691b7f0825b35dbce99ad5e06e7b82a1945a576fde09455fb94655a4748995d251da62e2
7
+ data.tar.gz: 3e47840ed4da82d9859876773436ad678f44b02e9b8aa1de34ed7f2de6b0a1ea4cb4b25738c627bc2d7bca1de27ced995e9b57e6f6af3e52badf499bdf5f4cd5
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 88.54
3
+ "covered_percent": 85.99
4
4
  }
5
5
  }
@@ -4,4 +4,5 @@ require 'checkoff/version'
4
4
  require 'checkoff/workspaces'
5
5
  require 'checkoff/projects'
6
6
  require 'checkoff/sections'
7
+ require 'checkoff/subtasks'
7
8
  require 'checkoff/tasks'
@@ -94,12 +94,6 @@ module Checkoff
94
94
  end
95
95
  cache_method :section_task_names, SHORT_CACHE_TIME
96
96
 
97
- # Returns all subtasks, including section headers
98
- def raw_subtasks(task)
99
- task.subtasks(projects.task_options)
100
- end
101
- cache_method :raw_subtasks, LONG_CACHE_TIME
102
-
103
97
  def task_due?(task)
104
98
  if task.due_at
105
99
  Time.parse(task.due_at) <= time.now
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+
5
+ module Checkoff
6
+ # Query different subtasks of Asana tasks
7
+ class Subtasks
8
+ MINUTE = 60
9
+ LONG_CACHE_TIME = MINUTE * 15
10
+ SHORT_CACHE_TIME = MINUTE * 5
11
+
12
+ extend Forwardable
13
+
14
+ def file_task_by_section(current_section, by_section, task)
15
+ if task.name =~ /:$/
16
+ current_section = task.name
17
+ by_section[current_section] = []
18
+ else
19
+ by_section[current_section] ||= []
20
+ by_section[current_section] << task
21
+ end
22
+ [current_section, by_section]
23
+ end
24
+
25
+ def by_section(tasks)
26
+ current_section = nil
27
+ by_section = {}
28
+ tasks.each do |task|
29
+ current_section, by_section = file_task_by_section(current_section,
30
+ by_section, task)
31
+ end
32
+ by_section
33
+ end
34
+
35
+ # Returns all subtasks, including section headers
36
+ def raw_subtasks(task)
37
+ task.subtasks(projects.task_options)
38
+ end
39
+ cache_method :raw_subtasks, LONG_CACHE_TIME
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Checkoff
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
@@ -1 +1 @@
1
- 390
1
+ 389
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
@@ -194,6 +194,7 @@ files:
194
194
  - lib/checkoff/config_loader.rb
195
195
  - lib/checkoff/projects.rb
196
196
  - lib/checkoff/sections.rb
197
+ - lib/checkoff/subtasks.rb
197
198
  - lib/checkoff/tasks.rb
198
199
  - lib/checkoff/version.rb
199
200
  - lib/checkoff/workspaces.rb