Merge pull request #3348 from aignatov-bio/ai-sci-5753-fix-export-all

Fast fix for export all [SCI-5753]
This commit is contained in:
Miha Mencin 2021-05-24 15:19:11 +02:00 committed by GitHub
commit e675e4004e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 6 deletions

View file

@ -272,7 +272,7 @@ class Project < ApplicationRecord
report = Report.generate_whole_project_report(self, user, team)
page_html_string =
renderer.render 'reports/new.html.erb',
renderer.render 'reports/new_old.html.erb',
locals: { export_all: true,
obj_filenames: obj_filenames },
assigns: { project: self, report: report }

View file

@ -103,7 +103,14 @@ class Report < ApplicationRecord
end
def self.generate_whole_project_report(project, current_user, current_team)
report_contents = gen_element_content(project, Extends::EXPORT_ALL_PROJECT_ELEMENTS)
# report_contents = gen_element_content(project, Extends::EXPORT_ALL_PROJECT_ELEMENTS)
content = {
'experiments' => {},
'repositories' => Repository.accessible_by_teams(project.team).pluck(:id)
}
project.experiments.includes(:my_modules).each do |experiment|
content['experiments'][experiment.id] = experiment.my_modules.pluck(:id)
end
report = Report.new
report.name = loop do
@ -114,7 +121,8 @@ class Report < ApplicationRecord
report.user = current_user
report.team = current_team
report.last_modified_by = current_user
report.save_with_contents(report_contents)
ReportActions::ReportContent.new(report, content, {}, current_user).save_with_content
# report.save_with_contents(report_contents)
report
end

View file

@ -26,8 +26,6 @@
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><%= link_to t("projects.reports.new.nav_pdf"), generate_pdf_project_report_path(@project, @report), id: "get-report-pdf" %></li>
<li><%= link_to t("projects.reports.new.nav_docx"), generate_docx_project_report_path(@project, @report), id: "get-report-docx" %></li>
</ul>
</div>

View file

@ -3,6 +3,9 @@
<meta name="turbolinks-visit-control" content="reload">
<% end %>
<% @settings = @report.settings %>
<% provide(:head_title, t("projects.reports.new.head_title", project: h(@project.name)).html_safe) %>
<%= render partial: "reports/new/report_navigation" %>
@ -77,7 +80,6 @@
</div>
</div>
<%= render partial: 'reports/new/save_PDF_to_inventory_modal' %>
<%= javascript_include_tag "handsontable.full" %>