Skip to content

Commit

Permalink
use actual dates in filename
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbradford committed Jul 27, 2023
1 parent 88d52eb commit e4b8a21
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/awon_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ def download_data
end
format.csv do
filename = begin
"#{stn.name} #{@db_class.description} - #{start_date} to #{end_date}.csv"
str = "#{stn.name} #{@db_class.description}"
if @results.exists?
earliest = @results.minimum(:date)
latest = @results.maximum(:date)
str += " #{earliest} to #{latest}"
end
str + ".csv"
rescue
"awon data.csv"
end
Expand Down

0 comments on commit e4b8a21

Please sign in to comment.