checkoff 0.13.2 → 0.14.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: 02474a060394a81034f63de6adf9753735b16be09b2a86756972dfa98d616a89
4
- data.tar.gz: 6da399f3f010e90f1f009c5a7ab8af66c78325979a60faddfe97b77da9b9442f
3
+ metadata.gz: 8750481397466c5207deda9bf852bc119c9ca347bd61ef97bdd8bd8b945d12f2
4
+ data.tar.gz: c65a0b1e37ef29fce62dbfe7cbfa5e92bcbc16dd0f8ff9be3a230a93840ce975
5
5
  SHA512:
6
- metadata.gz: 5637378bb6d83018437b6222cc5ded57addeeb17b4037aca23118fbde7279b8ae11c3e43ad58a39a32fcec40aa4f7133e2d1e330657c84d7a24bbe47f1f25f04
7
- data.tar.gz: 5195be1aae3a95d31d3c6d8a6a0b9647aef6ef8401c662458368b726ddda4c3c67305b4fef3b6719892447580b958d461ae6c964d08a22e4317dfc27f1b14b95
6
+ metadata.gz: 4e16e2aa1b336c7ef2213d19ea1301bd8c9c6c631957d58e063fdf6a3f278521ba77590aec15c661b4c6a908aa77fee7b9593551df9062edb3ce1c4a19c7cb46
7
+ data.tar.gz: 4dc5118ce5b1ef2a6eabf3e71ee494a05beed7c4135162200fbfc258147f81b62eaf218e9666a2132c04d1abb18d745a76c388fe058b5829de528b51dc2bf9ab
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.13.2)
15
+ checkoff (0.14.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "result": {
3
- "line": 99.72,
3
+ "line": 99.73,
4
4
  "branch": 94.44
5
5
  }
6
6
  }
@@ -16,9 +16,12 @@ module Checkoff
16
16
  @projects = projects
17
17
  end
18
18
 
19
- # true if the subtask passed in is actually a section header for subtasks
20
- def subtask_section?(task)
21
- task.name.end_with?(':')
19
+ # True if all subtasks of the task are completed
20
+ def all_subtasks_completed?(task)
21
+ raw_subtasks = raw_subtasks(task)
22
+ active_subtasks = @projects.active_tasks(raw_subtasks)
23
+ # anything left should be a section
24
+ active_subtasks.all? { |subtask| subtask_section?(subtask) }
22
25
  end
23
26
 
24
27
  # pulls a Hash of subtasks broken out by section
@@ -34,9 +37,20 @@ module Checkoff
34
37
 
35
38
  # Returns all subtasks, including section headers
36
39
  def raw_subtasks(task)
37
- task.subtasks(projects.task_options)
40
+ task_options = projects.task_options
41
+ task_options[:options][:fields] << 'is_rendered_as_separator'
42
+ task.subtasks(task_options)
43
+ end
44
+ cache_method :raw_subtasks, SHORT_CACHE_TIME
45
+
46
+ # True if the subtask passed in represents a section in the subtasks
47
+ #
48
+ # Note: expect this to be removed in a future version, as Asana is
49
+ # expected to move to the new-style way of representing sections
50
+ # as memberships with a separate API within a task.
51
+ def subtask_section?(subtask)
52
+ subtask.is_rendered_as_separator
38
53
  end
39
- cache_method :raw_subtasks, LONG_CACHE_TIME
40
54
 
41
55
  private
42
56
 
@@ -45,6 +45,11 @@ module Checkoff
45
45
  workspace: workspace_gid, name: name)
46
46
  end
47
47
 
48
+ # Return an end-user URL to the task in question
49
+ def url_of_task(task)
50
+ "https://app.asana.com/0/0/#{task.gid}/f"
51
+ end
52
+
48
53
  private
49
54
 
50
55
  def client
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Checkoff
4
4
  # Version of library
5
- VERSION = '0.13.2'
5
+ VERSION = '0.14.0'
6
6
  end
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.13.2
4
+ version: 0.14.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: 2021-08-01 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport