rename content_type to time_span_type for archives
This commit is contained in:
parent
9134114c2e
commit
dfbe004122
7 changed files with 24 additions and 19 deletions
|
@ -2,12 +2,12 @@
|
|||
#
|
||||
# Table name: archives
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# content_type :string not null
|
||||
# month :date
|
||||
# status :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# id :bigint not null, primary key
|
||||
# month :date
|
||||
# status :string not null
|
||||
# time_span_type :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
class Archive < ApplicationRecord
|
||||
include AASM
|
||||
|
@ -26,7 +26,7 @@ class Archive < ApplicationRecord
|
|||
)
|
||||
}
|
||||
|
||||
enum content_type: {
|
||||
enum time_span_type: {
|
||||
everything: 'everything',
|
||||
monthly: 'monthly'
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class Archive < ApplicationRecord
|
|||
end
|
||||
|
||||
def filename(procedure)
|
||||
if content_type == 'everything'
|
||||
if time_span_type == 'everything'
|
||||
"procedure-#{procedure.id}.zip"
|
||||
else
|
||||
"procedure-#{procedure.id}-mois-#{I18n.l(month, format: '%Y-%m')}.zip"
|
||||
|
|
|
@ -11,7 +11,7 @@ class ProcedureArchiveService
|
|||
.where(procedure: @procedure)
|
||||
|
||||
archive = Archive.for_groupe_instructeur(groupe_instructeurs).find_by(
|
||||
content_type: type,
|
||||
time_span_type: type,
|
||||
month: month
|
||||
)
|
||||
if archive.nil?
|
||||
|
@ -25,7 +25,7 @@ class ProcedureArchiveService
|
|||
end
|
||||
|
||||
def collect_files_archive(archive, instructeur)
|
||||
if archive.content_type == 'everything'
|
||||
if archive.time_span_type == 'everything'
|
||||
dossiers = @procedure.dossiers.state_termine
|
||||
else
|
||||
dossiers = @procedure.dossiers.processed_in_month(archive.month)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
%tbody
|
||||
- if can_generate_archive?(@dossiers_termines, @poids_total)
|
||||
%tr
|
||||
- matching_archive = @archives.find_by(content_type: 'everything')
|
||||
- matching_archive = @archives.find_by(time_span_type: 'everything')
|
||||
%td
|
||||
Tous les dossiers
|
||||
%td
|
||||
|
@ -60,7 +60,7 @@
|
|||
- @archivable_months.each do |month|
|
||||
- dossiers_termines = @procedure.dossiers.processed_in_month(month)
|
||||
- nb_dossiers_termines = dossiers_termines.count
|
||||
- matching_archive = @archives.find_by(content_type: 'monthly', month: month)
|
||||
- matching_archive = @archives.find_by(time_span_type: 'monthly', month: month)
|
||||
%tr
|
||||
%td
|
||||
= I18n.l(month, format: "%B %Y")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue