Skip to content

Commit

Permalink
Bug fixes (gitcoinco#1343)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Berry authored Jun 25, 2020
1 parent 1ce635a commit 1bc3c18
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/impressions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def create_impression
@virtual_impression[:ad_theme],
@virtual_impression[:ip_address],
@virtual_impression[:country_code],
request.user_agent.encode(Encoding::UTF_8, invalid: :replace),
request.user_agent.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: ""),
Time.current.iso8601
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/campaigns_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def campaign_tabs(campaign)
if authorized_user.can_admin_system? && campaign.campaign_bundle
tabs << {
name: "Estimate",
path: campaign_estimate_path(id: campaign.id)
path: campaign_estimate_path(id: campaign.id, campaign_id: campaign.id) # TODO Refactor
}
end
tabs
Expand Down
6 changes: 5 additions & 1 deletion app/models/concerns/properties/reportable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ def earnings(start = nil, stop = nil)
# Returns the average RPM (revenue per mille)
def average_rpm(start = nil, stop = nil)
s = summary(start, stop)
Money.new s.property_revenue.to_i / (s.impressions_count.to_i / 1000.to_f)
if s.impressions_count.to_i > 0
Money.new s.property_revenue.to_i / (s.impressions_count.to_i / 1000.to_f)
else
Money.new 0
end
rescue => e
Rollbar.error e
Money.new 0
Expand Down

0 comments on commit 1bc3c18

Please sign in to comment.