Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hidden] Provide download link for reports generated in the background #10661

Merged
merged 8 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 2 additions & 4 deletions app/controllers/admin/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def index
def show
@report = report_class.new(spree_current_user, params, render: render_data?)

if report_format.present?
if params[:report_format].present?
export_report
else
show_report
Expand Down Expand Up @@ -58,9 +58,7 @@ def render_data?

def render_report_as(format)
if OpenFoodNetwork::FeatureToggle.enabled?(:background_reports, spree_current_user)
filename = report_filename
filename = "#{filename}html" if report_format.blank?
@blob = ReportBlob.create_for_upload_later!(filename)
@blob = ReportBlob.create_for_upload_later!(report_filename)
ReportJob.perform_later(
report_class, spree_current_user, params, format, @blob
)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/reports_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def ransack_params
end

def report_format
params[:report_format]
params[:report_format].presence || "html"
dacook marked this conversation as resolved.
Show resolved Hide resolved
end

def report_filename
Expand Down