weighted_list_rank 0.4.0 → 0.4.2

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: f9afa895dc286e9cc5dd2370376b965eda825669debad06e21c232b996e2cab6
4
- data.tar.gz: 6116b3e97dc978a0ca8021f683ff7d5b31b1ebd1e0e3f07fc10c7a266b34659e
3
+ metadata.gz: b5d85e4ccc5456ad1bce7763d39d34d4dc14f831806b9c9bcee94f0c4d926898
4
+ data.tar.gz: dcf0013d694ce996c21335ed6d56d29f7dad96c03376e9a49ede00ae634c980b
5
5
  SHA512:
6
- metadata.gz: 71656bad8660b6ae1455afc06a406dddf69f688feb22b690b6dcef57b39aa2ba60df1fe14be91aa22af957b71960b7fe856a980b1769090ea039149fcb005abe
7
- data.tar.gz: cb30e3d19ed531e74ff7d665c92029a105c83a6d18e3ce98671c3471218c1c5fa6fc39672394161444b38cc2a97d0dfc2aeab60cfaedefde2664f246cd9ac5c6
6
+ metadata.gz: 6983978ad5b4b876e6e47100ec1134aa937606d5ba0a7bafcfd235c7a737b1f84063f7ee3b8bb19f1b56521cd7e6d53196fd15ef64c2f040b90ac8facf50354e
7
+ data.tar.gz: bc4fe3145c9f563c69fc13a718c65ba0696473a134b23fa46b960ffd0952c9a1ad775502e402f798661f758d9b63a745a3fa3dd953402e34e7ae854782da6d64
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.2] - 2024-07-01
4
+ - fixed bug where a score could be set to 0. the lowest a score can be now is 1
5
+
6
+ ## [0.4.1] - 2024-06-30
7
+ - add score_penalty to the list details hash
8
+
3
9
  ## [0.4.0] - 2024-06-26
4
10
  - Added score_penalty feature to allow percentage-based penalties on item scores.
5
11
  - Updated all dependencies to their latest versions.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weighted_list_rank (0.4.0)
4
+ weighted_list_rank (0.4.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -22,7 +22,7 @@ module WeightedListRank
22
22
  items[item.id] ||= {}
23
23
  # Ensure the list_details array exists, then append the new score detail
24
24
  items[item.id][:list_details] ||= []
25
- items[item.id][:list_details] << {list_id: list.id, score: score, weight: list.weight}
25
+ items[item.id][:list_details] << {list_id: list.id, score: score, weight: list.weight, score_penalty: item.score_penalty}
26
26
 
27
27
  # Ensure the total_score is initialized, then add the score
28
28
  items[item.id][:total_score] ||= 0
@@ -61,7 +61,10 @@ module WeightedListRank
61
61
  end
62
62
 
63
63
  # Apply score penalty if it exists
64
- apply_penalty(score, item.score_penalty)
64
+ score = apply_penalty(score, item.score_penalty)
65
+
66
+ # Ensure the score is not less than 1
67
+ [score, 1].max
65
68
  end
66
69
 
67
70
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WeightedListRank
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weighted_list_rank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Sherman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2024-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop