diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index 00c989780..6c1767cb1 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -31,7 +31,7 @@ class ReportsController < ApplicationController
before_action :check_manage_permissions, only: BEFORE_ACTION_METHODS
before_action :switch_team_with_param, only: :index
- after_action :generate_pdf_report, only: %i(create update)
+ after_action :generate_pdf_report, only: %i(create update generate_pdf)
# Index showing all reports of a single project
def index; end
@@ -101,7 +101,6 @@ class ReportsController < ApplicationController
).save_with_content
if @report.errors.blank?
- @report.pdf_processing!
log_activity(:create_report)
flash[:success] = t('projects.reports.index.generation.accepted_message')
@@ -138,7 +137,6 @@ class ReportsController < ApplicationController
).save_with_content
if @report.errors.blank?
- @report.pdf_processing!
log_activity(:edit_report)
flash[:success] = t('projects.reports.index.generation.accepted_message')
@@ -194,9 +192,6 @@ class ReportsController < ApplicationController
def generate_pdf
respond_to do |format|
format.json do
- @report.pdf_processing!
- log_activity(:generate_pdf_report)
- Reports::PdfJob.perform_later(@report.id, current_user)
render json: {
message: I18n.t('projects.reports.index.generation.accepted_message')
}
@@ -562,7 +557,10 @@ class ReportsController < ApplicationController
end
def generate_pdf_report
+ return unless @report.persisted?
+
+ @report.pdf_processing!
log_activity(:generate_pdf_report)
- Reports::PdfJob.perform_later(@report.id, current_user) if @report.persisted?
+ Reports::PdfJob.perform_later(@report.id, current_user)
end
end
diff --git a/app/views/reports/elements/_experiment_element.html.erb b/app/views/reports/elements/_experiment_element.html.erb
index 7f8c3812a..f2d53de1b 100644
--- a/app/views/reports/elements/_experiment_element.html.erb
+++ b/app/views/reports/elements/_experiment_element.html.erb
@@ -41,7 +41,9 @@
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_my_module_activity_element.html.erb b/app/views/reports/elements/_my_module_activity_element.html.erb
index 5c892e5ce..ec8336616 100644
--- a/app/views/reports/elements/_my_module_activity_element.html.erb
+++ b/app/views/reports/elements/_my_module_activity_element.html.erb
@@ -44,7 +44,9 @@
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_my_module_element.html.erb b/app/views/reports/elements/_my_module_element.html.erb
index 7eca56a45..e97db1f1b 100644
--- a/app/views/reports/elements/_my_module_element.html.erb
+++ b/app/views/reports/elements/_my_module_element.html.erb
@@ -99,9 +99,13 @@
<% end %>
<% end %>
-
- <%= children if (defined? children and children.present?) %>
-
+
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
+
<% if @settings.dig('task', 'activities') %>
<%= render partial: 'reports/elements/my_module_activity_element.html.erb', locals: { my_module: my_module } %>
diff --git a/app/views/reports/elements/_my_module_repository_element.html.erb b/app/views/reports/elements/_my_module_repository_element.html.erb
index 3c99b6568..46f32d5b7 100644
--- a/app/views/reports/elements/_my_module_repository_element.html.erb
+++ b/app/views/reports/elements/_my_module_repository_element.html.erb
@@ -47,7 +47,9 @@
<% end %>
-
- <%= children if defined?(children) && children.present? %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_my_module_result_asset_element.html.erb b/app/views/reports/elements/_my_module_result_asset_element.html.erb
index 5ca2ff75b..7ba94a6c1 100644
--- a/app/views/reports/elements/_my_module_result_asset_element.html.erb
+++ b/app/views/reports/elements/_my_module_result_asset_element.html.erb
@@ -65,7 +65,9 @@
<%= render partial: 'reports/elements/result_comments_element.html.erb', locals: { result: result } %>
<% end %>
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_my_module_result_table_element.html.erb b/app/views/reports/elements/_my_module_result_table_element.html.erb
index 8c19e5b65..5c9607c03 100644
--- a/app/views/reports/elements/_my_module_result_table_element.html.erb
+++ b/app/views/reports/elements/_my_module_result_table_element.html.erb
@@ -43,7 +43,9 @@
<%= render partial: 'reports/elements/result_comments_element.html.erb', locals: { result: result } %>
<% end %>
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_my_module_result_text_element.html.erb b/app/views/reports/elements/_my_module_result_text_element.html.erb
index 95f34d1cf..c4f77f3e5 100644
--- a/app/views/reports/elements/_my_module_result_text_element.html.erb
+++ b/app/views/reports/elements/_my_module_result_text_element.html.erb
@@ -40,7 +40,9 @@
<%= render partial: 'reports/elements/result_comments_element.html.erb', locals: { result: result } %>
<% end %>
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_my_module_step_element.html.erb b/app/views/reports/elements/_my_module_step_element.html.erb
index e3c8294de..15dfc858a 100644
--- a/app/views/reports/elements/_my_module_step_element.html.erb
+++ b/app/views/reports/elements/_my_module_step_element.html.erb
@@ -68,7 +68,9 @@
<%= render partial: 'reports/elements/step_comments_element.html.erb', locals: { step: step } %>
<% end %>
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_project_header_element.html.erb b/app/views/reports/elements/_project_header_element.html.erb
index 28462016b..64f3f83e1 100644
--- a/app/views/reports/elements/_project_header_element.html.erb
+++ b/app/views/reports/elements/_project_header_element.html.erb
@@ -20,7 +20,9 @@
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_result_comments_element.html.erb b/app/views/reports/elements/_result_comments_element.html.erb
index b84928b00..3b3621ec7 100644
--- a/app/views/reports/elements/_result_comments_element.html.erb
+++ b/app/views/reports/elements/_result_comments_element.html.erb
@@ -32,7 +32,9 @@
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_step_asset_element.html.erb b/app/views/reports/elements/_step_asset_element.html.erb
index 87e7ecebf..6bc53483a 100644
--- a/app/views/reports/elements/_step_asset_element.html.erb
+++ b/app/views/reports/elements/_step_asset_element.html.erb
@@ -42,7 +42,9 @@
<% end %>
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_step_checklist_element.html.erb b/app/views/reports/elements/_step_checklist_element.html.erb
index 4235409e7..a3e3fda45 100644
--- a/app/views/reports/elements/_step_checklist_element.html.erb
+++ b/app/views/reports/elements/_step_checklist_element.html.erb
@@ -38,7 +38,9 @@
<% end %>
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_step_comments_element.html.erb b/app/views/reports/elements/_step_comments_element.html.erb
index 7bc689a9b..22c4e077f 100644
--- a/app/views/reports/elements/_step_comments_element.html.erb
+++ b/app/views/reports/elements/_step_comments_element.html.erb
@@ -32,7 +32,9 @@
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>
diff --git a/app/views/reports/elements/_step_table_element.html.erb b/app/views/reports/elements/_step_table_element.html.erb
index b952e0442..96dc2397b 100644
--- a/app/views/reports/elements/_step_table_element.html.erb
+++ b/app/views/reports/elements/_step_table_element.html.erb
@@ -33,7 +33,9 @@
-
- <%= children if (defined? children and children.present?) %>
-
+ <% if defined?(children) %>
+
+ <%= children %>
+
+ <% end %>