From 18fe2cd207d8d2a5bb2581c744616295963abae9 Mon Sep 17 00:00:00 2001 From: Giga Chubinidze Date: Tue, 8 Nov 2022 16:06:48 +0400 Subject: [PATCH] update display of the current tasks with IDs [SCI-7205] --- app/models/my_module.rb | 3 +++ app/views/dashboards/current_tasks/_task.html.erb | 6 +++++- .../20221108104529_add_my_module_code_index.rb | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20221108104529_add_my_module_code_index.rb diff --git a/app/models/my_module.rb b/app/models/my_module.rb index 456f1a636..687ab040c 100644 --- a/app/models/my_module.rb +++ b/app/models/my_module.rb @@ -10,6 +10,9 @@ class MyModule < ApplicationRecord include PermissionCheckableModel include Assignable + ID_PREFIX = 'TA' + include PrefixedIdModel + attr_accessor :transition_error_rollback enum state: Extends::TASKS_STATES diff --git a/app/views/dashboards/current_tasks/_task.html.erb b/app/views/dashboards/current_tasks/_task.html.erb index 7c4db6821..6a0712913 100644 --- a/app/views/dashboards/current_tasks/_task.html.erb +++ b/app/views/dashboards/current_tasks/_task.html.erb @@ -1,7 +1,11 @@ <% task_date = current_task_date(task) %>
<%= task.experiment.project.name %> - /<%= task.experiment.name %>
+ / + <%= task.experiment.name %> + / + <%= task.code %> +
<%= task.name %>
diff --git a/db/migrate/20221108104529_add_my_module_code_index.rb b/db/migrate/20221108104529_add_my_module_code_index.rb new file mode 100644 index 000000000..41926ad7a --- /dev/null +++ b/db/migrate/20221108104529_add_my_module_code_index.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddMyModuleCodeIndex < ActiveRecord::Migration[6.1] + def up + ActiveRecord::Base.connection.execute( + "CREATE INDEX index_my_modules_on_my_module_code ON "\ + "my_modules using gin (('TA'::text || id) gin_trgm_ops);" + ) + end + + def down + remove_index :my_modules, name: 'index_my_modules_on_my_module_code' + end +end \ No newline at end of file