checkoff 0.99.0 → 0.100.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 +34 -13
- data/lib/checkoff/internal/task_timing.rb +2 -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: c1944705f29ddc4dab95bb2c056b55c3aa6417cab26ca036a5493612663a4614
|
4
|
+
data.tar.gz: 299262b20e9331ee86755c8fced359e62889e34f1fb714c694535167356c2793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f84b26f7790beb97d9f2467b00bead09cd59f60c57e448442892304bbbf7acd6c72c299ee2c890762d9682df76efcf203d5ff3b4442d88d8871b117006a18a83
|
7
|
+
data.tar.gz: b1478b9ac625f873fa32ab444facf710ac7246b118927fd3347ed0867ca182cb757ec8b12cbb83a29e4d00882647b6df45a93c2758fb2e4c1ebad5983b13b724
|
data/Gemfile.lock
CHANGED
@@ -114,7 +114,7 @@ module Checkoff
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
# :
|
117
|
+
# :ready_between_relative function
|
118
118
|
class ReadyBetweenRelativePFunctionEvaluator < FunctionEvaluator
|
119
119
|
FUNCTION_NAME = :ready_between_relative
|
120
120
|
|
@@ -134,24 +134,34 @@ module Checkoff
|
|
134
134
|
#
|
135
135
|
# @return [Boolean]
|
136
136
|
def evaluate(task, beginning_num_days_from_now, end_num_days_from_now, ignore_dependencies: false)
|
137
|
+
ready_between_relative?(task,
|
138
|
+
beginning_num_days_from_now, end_num_days_from_now,
|
139
|
+
ignore_dependencies: ignore_dependencies)
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
|
144
|
+
# @param task [Asana::Resources::Task]
|
145
|
+
# @param beginning_num_days_from_now [Integer]
|
146
|
+
# @param end_num_days_from_now [Integer]
|
147
|
+
# @param ignore_dependencies [Boolean]
|
148
|
+
#
|
149
|
+
# @return [Boolean]
|
150
|
+
def ready_between_relative?(task,
|
151
|
+
beginning_num_days_from_now,
|
152
|
+
end_num_days_from_now,
|
153
|
+
ignore_dependencies: false)
|
137
154
|
beginning_n_days_from_now_time = (Time.now + (beginning_num_days_from_now * 24 * 60 * 60))
|
138
155
|
end_n_days_from_now_time = (Time.now + (end_num_days_from_now * 24 * 60 * 60))
|
139
156
|
|
140
157
|
# @type [Date, Time, nil]
|
141
|
-
|
142
|
-
@task_timing.date_or_time_field_by_name(task, :due)
|
158
|
+
ready_date_or_time = @task_timing.date_or_time_field_by_name(task, :ready)
|
143
159
|
|
144
|
-
return false if
|
160
|
+
return false if ready_date_or_time.nil?
|
145
161
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
task_date_or_time <= end_n_days_from_now_time
|
150
|
-
else
|
151
|
-
# if date
|
152
|
-
task_date_or_time > beginning_n_days_from_now_time.to_date &&
|
153
|
-
task_date_or_time <= end_n_days_from_now_time.to_date
|
154
|
-
end
|
162
|
+
in_range = ready_in_range?(ready_date_or_time,
|
163
|
+
beginning_n_days_from_now_time,
|
164
|
+
end_n_days_from_now_time)
|
155
165
|
|
156
166
|
return false unless in_range
|
157
167
|
|
@@ -159,6 +169,17 @@ module Checkoff
|
|
159
169
|
|
160
170
|
true
|
161
171
|
end
|
172
|
+
|
173
|
+
# @param ready_date_or_time [Date, Time]
|
174
|
+
# @param start_time [Time]
|
175
|
+
# @param end_time [Time]
|
176
|
+
def ready_in_range?(ready_date_or_time, start_time, end_time)
|
177
|
+
if ready_date_or_time.is_a?(Time)
|
178
|
+
ready_date_or_time > start_time && ready_date_or_time <= end_time
|
179
|
+
else
|
180
|
+
ready_date_or_time > start_time.to_date && ready_date_or_time <= end_time.to_date
|
181
|
+
end
|
182
|
+
end
|
162
183
|
end
|
163
184
|
|
164
185
|
# :field_less_than_n_days_ago
|
data/lib/checkoff/version.rb
CHANGED