* VRFS-1496 fixing up help text and header text

This commit is contained in:
Seth Call 2014-07-27 11:49:26 -05:00
parent 4f7c1ef22e
commit 2716211b18
1 changed files with 15 additions and 17 deletions

View File

@ -1,4 +1,4 @@
ActiveAdmin.register_page "Score Exports" do ActiveAdmin.register_page "Download CSV" do
menu :parent => 'Score' menu :parent => 'Score'
page_action :create_csv, :method => :post do page_action :create_csv, :method => :post do
@ -18,20 +18,18 @@ ActiveAdmin.register_page "Score Exports" do
end_time = "#{end_time}" end_time = "#{end_time}"
end end
puts "start_time #{start_time}, end_time #{end_time}"
scores = ScoreHistory scores = ScoreHistory
.select("from_city, from_regions.regionname as from_region_name, from_countries.countryname as from_country_name, from_isp, .select("from_city, from_regions.regionname as from_region_name, from_countries.countryname as from_country_name, from_isp,
to_city, to_regions.regionname as to_region_name, to_countries.countryname as to_country_name, to_isp, to_city, to_regions.regionname as to_region_name, to_countries.countryname as to_country_name, to_isp,
min(score_histories.score) as min_latency, max(score_histories.score) as max_latency, avg(score_histories.score) as mean_latency, median(CAST(score_histories.score AS NUMERIC)) as median_latency, count(score_histories.score) as score_count") min(score_histories.score) as min_latency, max(score_histories.score) as max_latency, avg(score_histories.score) as mean_latency, median(CAST(score_histories.score AS NUMERIC)) as median_latency, count(score_histories.score) as score_count")
.joins('LEFT JOIN countries AS from_countries ON from_countries.countrycode = from_country') .joins('LEFT JOIN countries AS from_countries ON from_countries.countrycode = from_country')
.joins('LEFT JOIN countries AS to_countries ON to_countries.countrycode = to_country') .joins('LEFT JOIN countries AS to_countries ON to_countries.countrycode = to_country')
.joins('LEFT JOIN regions AS from_regions ON from_regions.region = from_region') .joins('LEFT JOIN regions AS from_regions ON from_regions.region = from_region')
.joins('LEFT JOIN regions AS to_regions ON to_regions.region = to_region') .joins('LEFT JOIN regions AS to_regions ON to_regions.region = to_region')
.where("score_dt BETWEEN DATE '#{start_time}' AND DATE '#{end_time}'") .where("score_dt BETWEEN DATE '#{start_time}' AND DATE '#{end_time}'")
.order('from_city, from_regions.regionname, from_countries.countryname, from_isp, to_city, to_regions.regionname, to_countries.countryname, to_isp') .order('from_city, from_regions.regionname, from_countries.countryname, from_isp, to_city, to_regions.regionname, to_countries.countryname, to_isp')
.group('from_city, from_regions.regionname, from_countries.countryname, from_isp, to_city, to_regions.regionname, to_countries.countryname, to_isp') .group('from_city, from_regions.regionname, from_countries.countryname, from_isp, to_city, to_regions.regionname, to_countries.countryname, to_isp')
.limit(1_000_000) .limit(1_000_000)
csv_string = CSV.generate do |csv| csv_string = CSV.generate do |csv|
@ -52,10 +50,10 @@ ActiveAdmin.register_page "Score Exports" do
end end
content :title => "Score Exports" do content :title => "Export Score" do
columns do columns do
column do column do
semantic_form_for :score_exports, :url => admin_score_exports_create_csv_path, :builder => ActiveAdmin::FormBuilder do |f| semantic_form_for :score_exports, :url => admin_download_csv_create_csv_path, :builder => ActiveAdmin::FormBuilder do |f|
f.inputs do f.inputs do
f.input :start, :as => :datepicker f.input :start, :as => :datepicker
f.input :end, :as => :datepicker f.input :end, :as => :datepicker
@ -78,7 +76,7 @@ ActiveAdmin.register_page "Score Exports" do
div do div do
span do "This report uses the score_histories table, which can lag up to 1 hour behind data. You can force a score_history sweep by going to" end span do "This report uses the score_histories table, which can lag up to 1 hour behind data. You can force a score_history sweep by going to" end
span do link_to "Resque", "#{Gon.global.prefix}resque/schedule" end span do link_to "Resque", "#{Gon.global.prefix}resque/schedule" end
span do " and then running ScoreHistorySweeper. When the job count goes from 1 to 0, the score_histories table is now completely up-to-date, and you can make a 'fresh' CSV." end span do " and then clicking 'Queue Now' for ScoreHistorySweeper. When the job count goes from 1 to 0, the score_histories table is now completely up-to-date, and you can make a 'fresh' CSV." end
end end
end end
end end