Skip to content

Commit

Permalink
Merge pull request #545 from slovensko-digital/GO-202/add_downloadabl…
Browse files Browse the repository at this point in the history
…e_attribute_to_upvs_forms

GO-202 Mark some UPVS forms as not downloadable
  • Loading branch information
luciajanikova authored Feb 6, 2025
2 parents 7437ec3 + 8ca7b19 commit c89d983
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/jobs/upvs/download_form_related_documents_job.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
11 changes: 6 additions & 5 deletions app/models/upvs/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20250205125502_add_downloadable_to_upvs_forms.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c89d983

Please sign in to comment.