Skip to content

Commit

Permalink
Rename remaining occurences of sort attribute of voucher to role
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterfarrell9 committed Aug 19, 2024
1 parent 73aa5e6 commit 0c705e2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/redemption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Redemption < ApplicationRecord
source_type: "Talk"

delegate :lecture, to: :voucher
delegate :sort, to: :voucher
delegate :role, to: :voucher
delegate :tutor?, to: :voucher
delegate :editor?, to: :voucher
delegate :teacher?, to: :voucher
Expand Down
6 changes: 3 additions & 3 deletions app/models/voucher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class Voucher < ApplicationRecord
where("expires_at > ? AND invalidated_at IS NULL",
Time.zone.now)
}
scope :for_tutors, -> { where(sort: :tutor) }
scope :for_editors, -> { where(sort: :editor) }
scope :for_speakers, -> { where(sort: :speaker) }
scope :for_tutors, -> { where(role: :tutor) }
scope :for_editors, -> { where(role: :editor) }
scope :for_speakers, -> { where(role: :speaker) }

self.implicit_order_column = "created_at"

Expand Down
2 changes: 1 addition & 1 deletion app/services/voucher_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def call
private

def process_voucher
case @voucher.sort
case @voucher.role
when "tutor"
process_tutor_voucher
when "editor"
Expand Down
2 changes: 1 addition & 1 deletion app/views/vouchers/verify.js.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$("#redeem-voucher").empty()
.append("<%= j render partial: 'vouchers/redeem_' + @voucher.sort + '_voucher', locals: { voucher: @voucher } %>");
.append("<%= j render partial: 'vouchers/redeem_' + @voucher.role + '_voucher', locals: { voucher: @voucher } %>");

// activate selectize
// @reviewer: This is used several times in our code base (in the coffeescript
Expand Down

0 comments on commit 0c705e2

Please sign in to comment.