From 71ddb2a2f33227df7155b10b9ad3ad60c614159f Mon Sep 17 00:00:00 2001
From: luciajanikova <19lucia99@gmail.com>
Date: Mon, 3 Feb 2025 15:37:33 +0100
Subject: [PATCH 1/3] Update view
---
app/components/message_threads_table_row_component.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/components/message_threads_table_row_component.html.erb b/app/components/message_threads_table_row_component.html.erb
index b70e69e9..73a78e34 100644
--- a/app/components/message_threads_table_row_component.html.erb
+++ b/app/components/message_threads_table_row_component.html.erb
@@ -53,7 +53,7 @@
<%#= render Common::TagComponent.new("2 nové správy") %>
From 016013b9168cbea7ad7181ff87330e01f172c1b6 Mon Sep 17 00:00:00 2001
From: luciajanikova <19lucia99@gmail.com>
Date: Wed, 5 Feb 2025 14:02:42 +0100
Subject: [PATCH 2/3] Mark some UPVS forms as not downloadable
---
app/jobs/upvs/download_form_related_documents_job.rb | 2 ++
app/models/upvs/form.rb | 11 ++++++-----
.../20250205125502_add_downloadable_to_upvs_forms.rb | 7 +++++++
3 files changed, 15 insertions(+), 5 deletions(-)
create mode 100644 db/migrate/20250205125502_add_downloadable_to_upvs_forms.rb
diff --git a/app/jobs/upvs/download_form_related_documents_job.rb b/app/jobs/upvs/download_form_related_documents_job.rb
index 813abff0..902cbf33 100644
--- a/app/jobs/upvs/download_form_related_documents_job.rb
+++ b/app/jobs/upvs/download_form_related_documents_job.rb
@@ -1,6 +1,8 @@
module Upvs
class DownloadFormRelatedDocumentsJob < ApplicationJob
def perform(upvs_form, downloader: ::Upvs::FormRelatedDocumentsDownloader)
+ return unless upvs_form.downloadable?
+
upvs_form_downloader = downloader.new(upvs_form)
upvs_form_downloader.download_related_document_by_type(:xsd)
diff --git a/app/models/upvs/form.rb b/app/models/upvs/form.rb
index 29c89417..a7d91f4e 100644
--- a/app/models/upvs/form.rb
+++ b/app/models/upvs/form.rb
@@ -2,11 +2,12 @@
#
# Table name: upvs_forms
#
-# id :bigint not null, primary key
-# identifier :string not null
-# version :string not null
-# created_at :datetime not null
-# updated_at :datetime not null
+# id :bigint not null, primary key
+# downloadable :boolean default(TRUE)
+# identifier :string not null
+# version :string not null
+# created_at :datetime not null
+# updated_at :datetime not null
#
class Upvs::Form < ApplicationRecord
has_many :related_documents, class_name: 'Upvs::FormRelatedDocument', foreign_key: 'upvs_form_id', dependent: :destroy
diff --git a/db/migrate/20250205125502_add_downloadable_to_upvs_forms.rb b/db/migrate/20250205125502_add_downloadable_to_upvs_forms.rb
new file mode 100644
index 00000000..77f9493a
--- /dev/null
+++ b/db/migrate/20250205125502_add_downloadable_to_upvs_forms.rb
@@ -0,0 +1,7 @@
+class AddDownloadableToUpvsForms < ActiveRecord::Migration[7.1]
+ def change
+ add_column :upvs_forms, :downloadable, :boolean, default: true
+
+ Upvs::Form.where(identifier: ['ks_352538', 'ks_362431']).update_all(downloadable: false)
+ end
+end
From 8ca7b19160680fa54750b42b8d5151d7d10c05b2 Mon Sep 17 00:00:00 2001
From: luciajanikova <19lucia99@gmail.com>
Date: Wed, 5 Feb 2025 14:15:06 +0100
Subject: [PATCH 3/3] Add schema.rb
---
db/schema.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/db/schema.rb b/db/schema.rb
index 7fa8c77d..dbd2421b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.1].define(version: 2025_01_14_170638) do
+ActiveRecord::Schema[7.1].define(version: 2025_02_05_125502) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
@@ -605,6 +605,7 @@
t.string "version", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.boolean "downloadable", default: true
t.index ["identifier", "version"], name: "index_forms_on_identifier_version", unique: true
end