From f2d30db92f793e9a469d208ad88251968d0088bc Mon Sep 17 00:00:00 2001 From: sboursen-scinote Date: Wed, 28 Feb 2024 15:40:09 +0100 Subject: [PATCH] Fix issues related to incorrect protocol template id/code [SCI-10299] --- app/javascript/vue/protocols/table.vue | 2 +- app/serializers/lists/protocol_serializer.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/javascript/vue/protocols/table.vue b/app/javascript/vue/protocols/table.vue index 493735bdb..50a87bc64 100644 --- a/app/javascript/vue/protocols/table.vue +++ b/app/javascript/vue/protocols/table.vue @@ -114,7 +114,7 @@ export default { cellRenderer: this.nameRenderer }, { - field: 'code', + field: 'original_code', headerName: this.i18n.t('protocols.index.thead.id'), sortable: true }, diff --git a/app/serializers/lists/protocol_serializer.rb b/app/serializers/lists/protocol_serializer.rb index 0599a2900..58ff346db 100644 --- a/app/serializers/lists/protocol_serializer.rb +++ b/app/serializers/lists/protocol_serializer.rb @@ -5,7 +5,7 @@ module Lists include Canaid::Helpers::PermissionsHelper include Rails.application.routes.url_helpers - attributes :name, :code, :keywords, :linked_tasks, :nr_of_versions, :assigned_users, :published_by, + attributes :name, :original_code, :keywords, :linked_tasks, :nr_of_versions, :assigned_users, :published_by, :published_on, :updated_at, :archived_by, :archived_on, :urls, :default_public_user_role_id, :hidden, :top_level_assignable, :has_draft, :team @@ -86,8 +86,8 @@ module Lists end if has_draft - object.initial_draft? ? object : object.draft - urls_list[:show_draft] = protocol_path(object) + draft = object.initial_draft? ? object : object.draft || object.parent.draft + urls_list[:show_draft] = protocol_path(draft) end if can_manage_protocol_users?(object)