checkoff 0.135.0 → 0.136.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1405ced59ee8be44fb64638fb70395489ac438812bb1307a58dc46f9bf2b0a3
4
- data.tar.gz: 2a3eb1041ff8894f18ea135774542c0efc09ed0f3ec1771130059aacd93b7733
3
+ metadata.gz: 5e9b8a139f08b5a53da99f785ac0e57bed14e919e43cc56ecf929c3558e4b567
4
+ data.tar.gz: 524fd6f5a31e9737403610de5b5e6ae42671e8f157702feeeec79f1154b99c1a
5
5
  SHA512:
6
- metadata.gz: 376987e755790ea699766a7d419ff07353122a256d6d398c4cfbc015ef29418f396e3b3b5761de595e28f0c9bf29baf74afe87ede5c885e6bea5b1d742ebc3bc
7
- data.tar.gz: 70c8298da537b7c9bdc9562eebdc03a5cffc04762917b9fcef577bef05c9dfc4bdc2a2bfba72c295b3dc7f343be08e1d4febbbcb3cc0817470118b0bca8adb0a
6
+ metadata.gz: df7a2327a7a1e63e15342dadcc6fded785de79c867bc4d9cf0de9b3d0c3c57d639c0908002162a188cd0fa261108b91a33788fd29f159f99f2f4139774f1a636
7
+ data.tar.gz: 55ffabad75909f3475ef78d702d6606be979dbce8ecbb3521133ec225651cdb53481ae4e5ddc571b587dbf88b63a1a7e78b3a7b271b43fa49169c15d80b26bad
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.135.0)
15
+ checkoff (0.136.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -9,6 +9,7 @@ require 'active_support'
9
9
  require 'forwardable'
10
10
  require 'cache_method'
11
11
  require_relative 'internal/config_loader'
12
+ require_relative 'internal/logging'
12
13
  require_relative 'workspaces'
13
14
  require_relative 'clients'
14
15
 
@@ -22,6 +23,8 @@ module Checkoff
22
23
  LONG_CACHE_TIME = MINUTE * 15
23
24
  SHORT_CACHE_TIME = MINUTE
24
25
 
26
+ include Logging
27
+
25
28
  # @param today_getter [Class<Date>]
26
29
  # @param now_getter [Class<Time>]
27
30
  def initialize(today_getter: Date,
@@ -128,20 +131,35 @@ module Checkoff
128
131
  (@now_getter.now + (num_days * 24 * 60 * 60))
129
132
  end
130
133
 
134
+ # @param num_days [Integer]
135
+ #
136
+ # @return [Date]
137
+ def n_days_from_today(num_days)
138
+ (@today_getter.today + num_days)
139
+ end
140
+
131
141
  # @param date_or_time [Date,Time,nil]
132
142
  # @param beginning_num_days_from_now [Integer,nil]
133
143
  # @param end_num_days_from_now [Integer,nil]
134
144
  def between_relative_days?(date_or_time, beginning_num_days_from_now, end_num_days_from_now)
135
- start_time = n_days_from_now(beginning_num_days_from_now || -99_999)
136
- end_time = n_days_from_now(end_num_days_from_now || 99_999)
145
+ start_date = n_days_from_today(beginning_num_days_from_now || -99_999)
146
+ end_date = n_days_from_today(end_num_days_from_now || 99_999)
137
147
 
138
148
  return false if date_or_time.nil?
139
149
 
140
- if date_or_time.is_a?(Time)
141
- date_or_time > start_time && date_or_time <= end_time
142
- else
143
- date_or_time > start_time.to_date && date_or_time <= end_time.to_date
150
+ date = if date_or_time.is_a?(Time)
151
+ date_or_time.localtime.to_date
152
+ else
153
+ date_or_time
154
+ end
155
+ out = date > start_date && date <= end_date
156
+ logger.debug do
157
+ "Checkoff::Timing#between_relative_days?(#{date_or_time.inspect} " \
158
+ "(as date: #{date.inspect}) " \
159
+ "#{beginning_num_days_from_now.inspect}, #{end_num_days_from_now.inspect}) " \
160
+ "comparing with #{start_date} and #{end_date} = #{out.inspect}"
144
161
  end
162
+ out
145
163
  end
146
164
 
147
165
  # @param date_or_time [Date,Time,nil]
@@ -3,5 +3,5 @@
3
3
  # Command-line and gem client for Asana (unofficial)
4
4
  module Checkoff
5
5
  # Version of library
6
- VERSION = '0.135.0'
6
+ VERSION = '0.136.0'
7
7
  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.135.0
4
+ version: 0.136.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-11-24 00:00:00.000000000 Z
11
+ date: 2023-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport