Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions app/commands/partner/log_perk_click.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@ class LogPerkClick
initialize_with :perk, :user, :clicked_at

def call
return unless valid_click?

Perk.where(id: perk.id).update_all('num_clicks = num_clicks + 1')
end

private
def valid_click?
return false if user&.admin?

true
end

def doc
{
perk_id: perk.id,
Expand Down
10 changes: 0 additions & 10 deletions test/commands/partner/log_perk_click_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,4 @@ class Partner::LogPerkClickTest < ActiveSupport::TestCase

assert_equal 1, perk.reload.num_clicks
end

test "doesn't log for admin users" do
perk = create :perk
user = create :user, :admin
assert_equal 0, perk.num_clicks

Partner::LogPerkClick.(perk, user, nil)

assert_equal 0, perk.reload.num_clicks
end
end
Loading