add preserve submitters order option

This commit is contained in:
Alex Turchyn
2023-09-10 02:10:01 +03:00
parent 07e49f9f07
commit 62cea05084
15 changed files with 118 additions and 28 deletions
+7
View File
@@ -7,6 +7,7 @@
# id :bigint not null, primary key
# deleted_at :datetime
# source :text not null
# submitters_order :string not null
# template_fields :text
# template_schema :text
# template_submitters :text
@@ -37,6 +38,7 @@ class Submission < ApplicationRecord
serialize :template_submitters, JSON
attribute :source, :string, default: 'link'
attribute :submitters_order, :string, default: 'random'
has_many :template_schema_documents,
->(e) { where(uuid: (e.template_schema.presence || e.template.schema).pluck('attachment_uuid')) },
@@ -50,4 +52,9 @@ class Submission < ApplicationRecord
embed: 'embed',
link: 'link'
}, scope: false, prefix: true
enum :submitters_order, {
random: 'random',
preserved: 'preserved'
}, scope: false, prefix: true
end