Fix protocol name in report [SCI-7077][SCI-7078]

This commit is contained in:
Anton 2022-08-09 13:50:00 +02:00
parent 897a8f71ec
commit 147127a739
4 changed files with 15 additions and 9 deletions

View file

@ -64,7 +64,7 @@ module Reports::Docx::DrawMyModule
link_style: link_style }).html_to_word_converter(html)
end
draw_my_module_protocol(my_module) if @settings.dig('task', 'protocol', 'description')
draw_my_module_protocol(my_module)
filter_steps_for_report(my_module.protocol.steps, @settings).order(:position).each do |step|
draw_step(step)

View file

@ -4,10 +4,14 @@ module Reports::Docx::DrawMyModuleProtocol
def draw_my_module_protocol(my_module)
protocol = my_module.protocol
@docx.p if protocol.description.present? || protocol.name.present?
@docx.h4 protocol.name, italic: false if protocol.name.present?
@docx.p
if protocol.name.present?
@docx.h4 protocol.name, italic: false
else
@docx.h4 I18n.t('projects.reports.elements.module.protocol.name'), italic: false
end
if protocol.description.present?
if @settings.dig('task', 'protocol', 'description') && protocol.description.present?
@docx.p I18n.t('projects.reports.elements.module.protocol.user_time',
timestamp: I18n.l(protocol.created_at, format: :full)), color: @color[:gray]
html = custom_auto_link(protocol.description, team: @report_team)

View file

@ -59,9 +59,7 @@
</div>
</div>
<div class="report-element-children">
<% if @settings.dig('task', 'protocol', 'description') %>
<%= render partial: 'reports/elements/my_module_protocol_element.html.erb', locals: { protocol: my_module.protocol } %>
<% end %>
<%= render partial: 'reports/elements/my_module_protocol_element.html.erb', locals: { protocol: my_module.protocol } %>
<% filter_steps_for_report(my_module.protocol.steps, @settings).order(:position).each do |step| %>
<%= render partial: 'reports/elements/my_module_step_element.html.erb', locals: { step: step, export_all: export_all } %>

View file

@ -3,13 +3,17 @@
<div class="report-element report-module-protocol-element">
<div class="report-element-body">
<div class="protocol-name">
<%= protocol.name || t('projects.reports.elements.module.protocol.name') %>
<% if protocol.name.present? %>
<%= protocol.name %>
<% else %>
<%= t('projects.reports.elements.module.protocol.name') %>
<% end %>
</div>
<div class="user-time">
<%= t('projects.reports.elements.module.protocol.user_time', timestamp: l(protocol.created_at, format: :full)) %>
</div>
<div class="row module-protocol-description">
<% if protocol.description.present? %>
<% if @settings.dig('task', 'protocol', 'description') && protocol.description.present? %>
<%= custom_auto_link(protocol.prepare_for_report(:description, export_all),
team: current_team,
simple_format: false,