w_rate 0.1.0 → 0.1.1
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/lib/w_rate/version.rb +1 -1
- data/lib/w_rate/version.rb~ +3 -0
- data/lib/w_rate.rb +3 -3
- data/lib/w_rate.rb~ +14 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c3aee8623e2d267c5006b96542b8967a723ffb7
|
4
|
+
data.tar.gz: 7770375ff8d115e976b7746558a96326089ff3e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b885138f4bc92534f9524cf4f22e3e5d033764d98a93f15e19157cebfc37d1ce63e4edf546ada439c1f46789509a985145ec382de36ffcf48722c4b85ac2679a
|
7
|
+
data.tar.gz: 13cc48522ead404738c5d1422dda5662f2894a07208f1667a810b3add18ac491b3eb39db78cd5a612307cb1064f4d58e20ea359502d3ddb6965a5edd6d3b9c4b
|
data/lib/w_rate/version.rb
CHANGED
data/lib/w_rate.rb
CHANGED
@@ -11,8 +11,8 @@ if votes_count < switch_number
|
|
11
11
|
rating=(phat+(z*z)/(2*votes_count)+z*Math.sqrt((phat*(1-phat)+(z*z)/(4*votes_count))/votes_count))/(1+(z*z)/votes_count)
|
12
12
|
else
|
13
13
|
rating = (phat+(z*z)/(2*votes_count)-z*Math.sqrt((phat*(1-phat)+(z*z)/(4*votes_count))/votes_count))/(1+(z*z)/votes_count)
|
14
|
-
|
15
|
-
rating=(rating_high+rating_low)/2
|
14
|
+
end
|
16
15
|
return rating * v_width + v_min
|
17
|
-
|
16
|
+
|
17
|
+
end
|
18
18
|
end
|
data/lib/w_rate.rb~
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
require "w_rate/version"
|
2
2
|
|
3
|
-
|
3
|
+
class WRate
|
4
4
|
# Your code goes here...
|
5
|
+
def rate(sum_rating, votes_count, votes_range = [1, 5], switch_number)
|
6
|
+
z = 1.6
|
7
|
+
v_min = votes_range.min
|
8
|
+
v_width = (votes_range.max - v_min).to_f
|
9
|
+
phat = (sum_rating - votes_count.to_f * v_min) / v_width / votes_count.to_f
|
10
|
+
if votes_count < switch_number
|
11
|
+
rating=(phat+(z*z)/(2*votes_count)+z*Math.sqrt((phat*(1-phat)+(z*z)/(4*votes_count))/votes_count))/(1+(z*z)/votes_count)
|
12
|
+
else
|
13
|
+
rating = (phat+(z*z)/(2*votes_count)-z*Math.sqrt((phat*(1-phat)+(z*z)/(4*votes_count))/votes_count))/(1+(z*z)/votes_count)
|
14
|
+
|
15
|
+
rating=(rating_high+rating_low)/2
|
16
|
+
return rating * v_width + v_min
|
17
|
+
end
|
5
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: w_rate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siyko
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/w_rate.rb
|
72
72
|
- lib/w_rate.rb~
|
73
73
|
- lib/w_rate/version.rb
|
74
|
+
- lib/w_rate/version.rb~
|
74
75
|
- w_rate.gemspec
|
75
76
|
- w_rate.gemspec~
|
76
77
|
homepage: ''
|