sof-cycle 0.1.6 → 0.1.7

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: 33cc5f466f7776bd9476664153cf9ae0e3f898132b348cffa0117a911ad7dda6
4
- data.tar.gz: a30b3ea58dce3a953531deffba10f9199af3b283fdf70f99d7af55988aef428e
3
+ metadata.gz: c3012f6707b4790074bd8d39619c93abbca8ffd333c4942365c1b995c321040a
4
+ data.tar.gz: a9b8032594afa34f6aada7bbd8709cf05898dfb68bdd4f45f3a7e64270853054
5
5
  SHA512:
6
- metadata.gz: ce71b8b026ee7e78c6d6568dea2a88eb2d5faee74cbc4cc4e7c6f78bf7e328b46ba7017e71acf75f7b8613204e6e7a56b9592987d559c5883c1901ead1119718
7
- data.tar.gz: 306c295e768f6616c80ebe3ee8adbfb734d64b01b2b4fd5d52a45ac9e913752b660bbc7a77129adfd66fb517adb6c0217ec11f4c62518c32620c788a3803c91b
6
+ metadata.gz: 97f6a123c55cc133347ee5cad99639f7105a19397b7a8bfeaad0f72ac9ef0da0748a51bc40a3976816f347e4075463bc18ee9184bfe6837308d2dcc438bd72dc
7
+ data.tar.gz: 6fa462d207af7d7fc7e659a5e586ad19d5cec3a6042814ba89254974b566054f27ee6dd2efbb661c2804deef174a99c6f3ae5e26e273d57edf7a0f0f0e8a2d4e
data/CHANGELOG.md CHANGED
@@ -5,14 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [0.1.6] - 2024-09-04
8
+ ## [0.1.7] - 2025-06-09
9
9
 
10
10
  ### Added
11
11
 
12
- - `Cycle.extend_period(count)` to get a new cycle with the modified period count
13
-
14
- ## [0.1.5] - 2024-09-02
12
+ - `Cycle#considered_dates` to get the subset of `#covered_dates` that are
13
+ considered for the cycle's calculations.
15
14
 
16
15
  ### Fixed
17
16
 
18
- - `Cycle#last_completed` works for dormant cycles too
17
+ - `Cycles::Lookback.volume_to_delay_expiration` now computes correctly when the
18
+ `#considered_dates` is smaller than the `#covered_dates` of the cycle.
19
+
20
+ ## [0.1.6] - 2024-09-04
21
+
22
+ ### Added
23
+
24
+ - `Cycle.extend_period(count)` to get a new cycle with the modified period count
@@ -0,0 +1 @@
1
+ 4a0a79b2c4566319f3a28a400b5c5e471a4d3e6acf979f02b38546cfab34c11d4dd1b1b5118eab0b5cbcab77ed54fb896dc81f4fa58afe41ae437ed79f44f235
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SOF
4
4
  class Cycle
5
- VERSION = "0.1.6"
5
+ VERSION = "0.1.7"
6
6
  end
7
7
  end
data/lib/sof/cycle.rb CHANGED
@@ -175,6 +175,10 @@ module SOF
175
175
  covered_dates(completion_dates, anchor:).size >= volume
176
176
  end
177
177
 
178
+ def considered_dates(completion_dates, anchor: Date.current)
179
+ covered_dates(completion_dates, anchor:).max_by(volume) { _1 }
180
+ end
181
+
178
182
  def covered_dates(dates, anchor: Date.current)
179
183
  dates.select do |date|
180
184
  cover?(date, anchor:)
@@ -13,8 +13,12 @@ module SOF
13
13
  def to_s = "#{volume}x in the prior #{period_count} #{humanized_period}"
14
14
 
15
15
  def volume_to_delay_expiration(completion_dates, anchor:)
16
- oldest_relevant_completion = completion_dates.min
17
- [completion_dates.count(oldest_relevant_completion), volume].min
16
+ relevant_dates = considered_dates(completion_dates, anchor:)
17
+ return unless satisfied_by?(relevant_dates, anchor:)
18
+
19
+ # To move the expiration date, we need to displace each occurance of the
20
+ # oldest date within #considered_dates.
21
+ relevant_dates.count(relevant_dates.min)
18
22
  end
19
23
 
20
24
  # "Absent further completions, you go red on this date"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sof-cycle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-09-04 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: forwardable
@@ -38,7 +37,6 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '6.0'
41
- description:
42
40
  email:
43
41
  - jim@saturnflyer.com
44
42
  executables: []
@@ -53,6 +51,7 @@ files:
53
51
  - checksums/sof-cycle-0.1.0.gem.sha512
54
52
  - checksums/sof-cycle-0.1.1.gem.sha512
55
53
  - checksums/sof-cycle-0.1.2.gem.sha512
54
+ - checksums/sof-cycle-0.1.6.gem.sha512
56
55
  - lib/sof-cycle.rb
57
56
  - lib/sof/cycle.rb
58
57
  - lib/sof/cycle/version.rb
@@ -69,7 +68,6 @@ licenses: []
69
68
  metadata:
70
69
  homepage_uri: https://github.com/SOFware/sof-cycle
71
70
  changelog_uri: https://github.com/SOFware/sof-cycle/blob/main/CHANGELOG.md
72
- post_install_message:
73
71
  rdoc_options: []
74
72
  require_paths:
75
73
  - lib
@@ -84,8 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
82
  - !ruby/object:Gem::Version
85
83
  version: '0'
86
84
  requirements: []
87
- rubygems_version: 3.5.11
88
- signing_key:
85
+ rubygems_version: 3.6.7
89
86
  specification_version: 4
90
87
  summary: Parse and interact with SOF cycle notation.
91
88
  test_files: []