checkoff 0.179.0 → 0.181.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/internal/selector_classes/task.rb +25 -0
- data/lib/checkoff/timing.rb +19 -0
- data/lib/checkoff/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4375c2b0377fc7ccfb25e724d4d5dfcaba964c9abb6080a46f4948a6cb58d5a9
|
4
|
+
data.tar.gz: 799f7950940dd1c9be03f6521dd876667b6935c02171cd88d23044172b80fa6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee8b4f82321e18945ed5327263d172c5dbc9de9ee092504076d90918f865dfb1ba1ae6fe1e0b6a9a6f128755557c6ac22d97d93d2ce13d7ca601f23db977fe0e
|
7
|
+
data.tar.gz: 293b79d78064763fd18a4d012cc301f2283857efea170c01cd2ce1beb27b852f0f0013c59a3c4188ce81a0e94aa274e83f80bb6ad21500343af97a1b63155b01
|
data/Gemfile.lock
CHANGED
@@ -6,6 +6,31 @@ require 'checkoff/internal/task_timing'
|
|
6
6
|
module Checkoff
|
7
7
|
module SelectorClasses
|
8
8
|
module Task
|
9
|
+
# :in_a_real_project? function
|
10
|
+
class InARealProjectPFunctionEvaluator < FunctionEvaluator
|
11
|
+
def matches?
|
12
|
+
fn?(selector, :in_a_real_project?)
|
13
|
+
end
|
14
|
+
|
15
|
+
# @param _index [Integer]
|
16
|
+
def evaluate_arg?(_index)
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
# @sg-ignore
|
21
|
+
# @param task [Asana::Resources::Task]
|
22
|
+
# @return [Boolean]
|
23
|
+
def evaluate(task)
|
24
|
+
# @type [Hash{'unwrapped' => Hash}]
|
25
|
+
task_data = @tasks.task_to_h(task)
|
26
|
+
# @type [Hash{'membership_by_project_name' => Hash}]
|
27
|
+
unwrapped = task_data.fetch('unwrapped')
|
28
|
+
# @type [Array]
|
29
|
+
projects = unwrapped.fetch('membership_by_project_name').keys
|
30
|
+
!(projects - [:my_tasks]).empty?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
9
34
|
# :section_name_starts_with? function
|
10
35
|
class SectionNameStartsWithPFunctionEvaluator < FunctionEvaluator
|
11
36
|
def matches?
|
data/lib/checkoff/timing.rb
CHANGED
@@ -40,6 +40,8 @@ module Checkoff
|
|
40
40
|
def in_period?(date_or_time, period)
|
41
41
|
return this_week?(date_or_time) if period == :this_week
|
42
42
|
|
43
|
+
return next_week?(date_or_time) if period == :next_week
|
44
|
+
|
43
45
|
return day_of_week?(date_or_time, period) if %i[monday tuesday wednesday thursday friday saturday
|
44
46
|
sunday].include?(period)
|
45
47
|
|
@@ -120,6 +122,23 @@ module Checkoff
|
|
120
122
|
date >= beginning_of_week && date <= end_of_week
|
121
123
|
end
|
122
124
|
|
125
|
+
# @param date_or_time [Date,Time,nil]
|
126
|
+
def next_week?(date_or_time)
|
127
|
+
return false if date_or_time.nil?
|
128
|
+
|
129
|
+
today = @today_getter.today
|
130
|
+
|
131
|
+
# Beginning of next week (assuming week starts on Sunday)
|
132
|
+
beginning_of_week = today - today.wday + 7
|
133
|
+
|
134
|
+
# End of this week (assuming week ends on Saturday)
|
135
|
+
end_of_week = beginning_of_week + 6
|
136
|
+
|
137
|
+
date = date_or_time.to_date
|
138
|
+
|
139
|
+
date >= beginning_of_week && date <= end_of_week
|
140
|
+
end
|
141
|
+
|
123
142
|
# @type [Hash<Symbol,Integer>]
|
124
143
|
WDAY_FROM_DAY_OF_WEEK = {
|
125
144
|
monday: 1,
|
data/lib/checkoff/version.rb
CHANGED