voting 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +7 -0
- data/README.md +1 -5
- data/lib/generators/voting/install_generator.rb +1 -1
- data/lib/generators/voting/templates/db/migrate/create_voting_tables.rb +4 -4
- data/lib/voting/models/voting/extension.rb +11 -11
- data/lib/voting/models/voting/vote.rb +1 -1
- data/lib/voting/models/voting/voting.rb +1 -1
- data/lib/voting/version.rb +1 -1
- data/spec/factories/voting/voting.rb +1 -1
- data/spec/models/vote/status_spec.rb +0 -1
- data/spec/support/shared_context/with_database_records.rb +2 -0
- metadata +5 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7bffe7669898ab09e908e5e869f11177db187c491d7ae6d96ed8e6c9814323ba
|
4
|
+
data.tar.gz: b586d8c3d692abc2e6ca0389988b797c83c70bfbfbbd947e28f83fe768f81509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42dfc72e269ad484fc0d337fe1cb089cad2d27057bbf83e8873c7fcce62e6ffc1c5dcae870215d670751a5197b624bc1ed55d1113b6a5bbc9df3cec46005c2c0
|
7
|
+
data.tar.gz: dbe5b7d635f3f7431d98f90095ea959eb2b32eb4ed909d79cbdf6051db07cca037d0491fa6f78ea9f0718be926e7746418daef6150f3452c8683f0248d75085b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Build Status](https://travis-ci.org/wbotelhos/voting.svg)](https://travis-ci.org/wbotelhos/voting)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/voting.svg)](https://badge.fury.io/rb/voting)
|
5
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/dcdf51e3093148c5ac6a/maintainability)](https://codeclimate.com/github/wbotelhos/voting/maintainability)
|
6
|
-
[![
|
6
|
+
[![Patreon](https://img.shields.io/badge/donate-%3C3-brightgreen.svg)](https://www.patreon.com/wbotelhos)
|
7
7
|
|
8
8
|
A Binomial proportion confidence interval voting system with scope and cache enabled.
|
9
9
|
|
@@ -264,7 +264,3 @@ Now, when a resource is created, the cache will be generated for each related `c
|
|
264
264
|
- [Jonathan Landy](http://efavdb.com/ranking-revisited)
|
265
265
|
- [Wilson Score Interval](https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval)
|
266
266
|
- [How to Count Thumb-Ups and Thumb-Downs](http://www.dcs.bbk.ac.uk/~dell/publications/dellzhang_ictir2011.pdf)
|
267
|
-
|
268
|
-
## Love it!
|
269
|
-
|
270
|
-
Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=voting) or [Support](https://liberapay.com/wbotelhos). Thanks! (:
|
@@ -14,8 +14,8 @@ class CreateVotingTables < ActiveRecord::Migration[5.0]
|
|
14
14
|
end
|
15
15
|
|
16
16
|
add_index :voting_votes, %i[author_id author_type resource_id resource_type scopeable_id scopeable_type],
|
17
|
-
|
18
|
-
|
17
|
+
name: :index_voting_votes_on_author_and_resource_and_scopeable,
|
18
|
+
unique: true
|
19
19
|
|
20
20
|
create_table :voting_votings do |t|
|
21
21
|
t.decimal :estimate, default: 0, mull: false, precision: 25, scale: 20
|
@@ -29,7 +29,7 @@ class CreateVotingTables < ActiveRecord::Migration[5.0]
|
|
29
29
|
end
|
30
30
|
|
31
31
|
add_index :voting_votings, %i[resource_id resource_type scopeable_id scopeable_type],
|
32
|
-
|
33
|
-
|
32
|
+
name: :index_voting_votings_on_resource_and_scopeable,
|
33
|
+
unique: true
|
34
34
|
end
|
35
35
|
end
|
@@ -59,23 +59,23 @@ module Voting
|
|
59
59
|
after_create -> { voting_warm_up scoping: scoping }, unless: -> { as == :author }
|
60
60
|
|
61
61
|
has_many :voting_records,
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
as: :resource,
|
63
|
+
class_name: '::Voting::Voting',
|
64
|
+
dependent: :destroy
|
65
65
|
|
66
66
|
has_many :votes_records,
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
as: :resource,
|
68
|
+
class_name: '::Voting::Vote',
|
69
|
+
dependent: :destroy
|
70
70
|
|
71
71
|
has_many :voted_records,
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
as: :author,
|
73
|
+
class_name: '::Voting::Vote',
|
74
|
+
dependent: :destroy
|
75
75
|
|
76
|
-
scope :order_by_voting,
|
76
|
+
scope :order_by_voting, lambda { |column = :estimate, direction = :desc, scope: nil|
|
77
77
|
scope_values = {
|
78
|
-
scopeable_id:
|
78
|
+
scopeable_id: scope&.id,
|
79
79
|
scopeable_type: scope&.class&.base_class&.name
|
80
80
|
}
|
81
81
|
|
@@ -15,7 +15,7 @@ module Voting
|
|
15
15
|
|
16
16
|
validates :author_id, uniqueness: {
|
17
17
|
case_sensitive: false,
|
18
|
-
scope:
|
18
|
+
scope: %i[author_type resource_id resource_type scopeable_id scopeable_type]
|
19
19
|
}
|
20
20
|
|
21
21
|
def status
|
data/lib/voting/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Washington Botelho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '6'
|
19
|
+
version: '0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '6'
|
26
|
+
version: '0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: database_cleaner
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,8 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
201
|
- !ruby/object:Gem::Version
|
208
202
|
version: '0'
|
209
203
|
requirements: []
|
210
|
-
|
211
|
-
rubygems_version: 2.6.14
|
204
|
+
rubygems_version: 3.0.6
|
212
205
|
signing_key:
|
213
206
|
specification_version: 4
|
214
207
|
summary: A Binomial proportion confidence interval voting system with scope and cache
|