Skip to content
This repository has been archived by the owner on Aug 13, 2020. It is now read-only.

Commit

Permalink
Fix bugs that led to broken pages (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Berry authored Jun 23, 2020
1 parent 22a3af3 commit 54e3c1c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/controllers/property_instructions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ class PropertyInstructionsController < ApplicationController

def set_property
@property = if authorized_user.can_admin_system?
Property.find(params[:property_id])
Property.find_by(id: params[:property_id])
else
current_user.properties.find(params[:property_id])
current_user.properties.find_by(id: params[:property_id])
end
render_not_found unless @property
end
end
12 changes: 9 additions & 3 deletions app/helpers/campaigns_helper.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
module CampaignsHelper
def campaign_tabs(campaign)
[
tabs = [
{name: "Overview", path: campaign_path(campaign), active: :exact},
{name: "Daily Stats", path: campaign_dailies_path(campaign)},
{name: "Creatives", path: campaign_creatives_path(campaign)},
{name: "Properties", path: campaign_properties_path(campaign)},
{name: "Countries", path: campaign_countries_path(campaign)},
{name: "Comments", path: campaign_comments_path(campaign), validation: authorized_user.can_view_comments?},
{name: "Settings", path: edit_campaign_path(campaign)},
{name: "Estimate", path: campaign_estimate_path(campaign), validation: authorized_user.can_admin_system? && campaign.campaign_bundle}
{name: "Settings", path: edit_campaign_path(campaign)}
]
if authorized_user.can_admin_system? && campaign.campaign_bundle
tabs << {
name: "Estimate",
path: campaign_estimate_path(id: campaign.id)
}
end
tabs
end

def campaign_reports_email_error_message(campaign)
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/properties/reportable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def earnings(start = nil, stop = nil)
# Returns the average RPM (revenue per mille)
def average_rpm(start = nil, stop = nil)
s = summary(start, stop)
s.property_revenue / (s.impressions_count / 1000.to_f)
s.property_revenue.to_i / (s.impressions_count.to_i / 1000.to_f)
rescue => e
Rollbar.error e
Money.new 0
Expand Down

0 comments on commit 54e3c1c

Please sign in to comment.