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_advert_click.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@ class LogAdvertClick
initialize_with :advert, :user, :clicked_at, :impression_uuid

def call
return unless valid_click?

Advert.where(id: advert.id).update_all('num_clicks = num_clicks + 1')
end

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

true
end

def doc
{
advert_id: advert.id,
Expand Down
2 changes: 1 addition & 1 deletion app/css/components/perk.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@apply flex flex-col items-stretch;

.logo {
@apply h-[40px] max-w-[190px];
@apply h-[40px];
@apply mb-12;
@apply self-start;
}
Expand Down
10 changes: 0 additions & 10 deletions test/commands/partner/log_advert_click_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,4 @@ class Partner::LogAdvertClickTest < ActiveSupport::TestCase

assert_equal 1, advert.reload.num_clicks
end

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

Partner::LogAdvertClick.(advert, user, nil, nil)

assert_equal 0, advert.reload.num_clicks
end
end
Loading