weighted_list_rank 0.1.1 → 0.1.3
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/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/lib/weighted_list_rank/context.rb +3 -2
- data/lib/weighted_list_rank/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a649927ba7b5ed331d9721b6a9ba7aa044017956b0aec6484649ee7c9d8d55e1
|
4
|
+
data.tar.gz: '01833e4d548f1df8c2428dcce387bf57652c91ea1bf53044420d8720e2137d10'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fec2c7d118e678ee0284e9db56e99125681f5d67268250a3e0db142ea76edf1e9dd58f9b0c53fdfdb3f560feb25e5a731fb33ad71164f0ab45e9ca601ec9be4
|
7
|
+
data.tar.gz: d24a0349aeec1813215a3b842a22729de2f90c144a75944872bf000e46008567fee30d8fccfb1b209051cf34d54a616c1faa5411ac2f135d9cfc2bc5eef7371e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.1.3] - 2024-02-03
|
4
|
+
|
5
|
+
- sprt the score_details by the highest score from each list first
|
6
|
+
|
7
|
+
## [0.1.2] - 2024-02-03
|
8
|
+
|
9
|
+
- Added list weight to rank result
|
10
|
+
-
|
3
11
|
## [0.1.1] - 2024-02-03
|
4
12
|
|
5
13
|
- Fixed Exponential strategy to just return the list weight if the item has a nil position
|
data/Gemfile.lock
CHANGED
@@ -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}
|
25
|
+
items[item.id][:list_details] << {list_id: list.id, score: score, weight: list.weight}
|
26
26
|
|
27
27
|
# Ensure the total_score is initialized, then add the score
|
28
28
|
items[item.id][:total_score] ||= 0
|
@@ -34,7 +34,8 @@ module WeightedListRank
|
|
34
34
|
sorted_items = items.map do |id, details|
|
35
35
|
{
|
36
36
|
id: id,
|
37
|
-
score_details
|
37
|
+
# Sort the score_details array by score in descending order before including it
|
38
|
+
score_details: details[:list_details].sort_by { |detail| -detail[:score] },
|
38
39
|
total_score: details[:total_score]
|
39
40
|
}
|
40
41
|
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.1.
|
4
|
+
version: 0.1.3
|
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-02-
|
11
|
+
date: 2024-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|