Merge pull request #4328 from aignatov-bio/ai-sci-7077-fix-report-protocol-name-issue

Fix protocol name in report [SCI-7077][SCI-7078]
This commit is contained in:
aignatov-bio 2022-08-10 10:06:05 +02:00 committed by GitHub
commit b4e7877b99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 %>
<% 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,