Skip to content

Commit

Permalink
Add completed scope to referral model
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Jul 17, 2024
1 parent 56de449 commit a7d9b1a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### Unreleased

### 0.4.0

* Add `completed` scope to `Refer::Referral`

### 0.3.0

* Add visit tracking #5
* Configurable referral cookie overwrites #4
Choose between the original referral code or the most recent referral code to receive the referral
Expand Down
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
refer (0.3.0)
refer (0.4.0)
rails (>= 6.1.0)

GEM
Expand Down Expand Up @@ -125,7 +125,7 @@ GEM
nokogiri (1.16.6-x86_64-linux)
racc (~> 1.4)
parallel (1.25.1)
parser (3.3.3.0)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
psych (5.1.2)
Expand Down Expand Up @@ -177,22 +177,22 @@ GEM
regexp_parser (2.9.2)
reline (0.5.9)
io-console (~> 0.5)
rexml (3.3.1)
rexml (3.3.2)
strscan
rubocop (1.64.1)
rubocop (1.65.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-minitest (0.35.0)
rubocop-minitest (0.35.1)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.21.1)
Expand Down
2 changes: 2 additions & 0 deletions app/models/refer/referral.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class Referral < ApplicationRecord
belongs_to :referee, polymorphic: true
belongs_to :referral_code, optional: true, counter_cache: true

scope :completed, -> { where.not(completed_at: nil) }

before_validation do
self.referrer = referral_code&.referrer
end
Expand Down
2 changes: 1 addition & 1 deletion lib/refer/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Refer
VERSION = "0.3.0"
VERSION = "0.4.0"
end

0 comments on commit a7d9b1a

Please sign in to comment.