2022-12-23 14:05:39 +01:00
|
|
|
class Procedure::RevisionChangesComponent < ApplicationComponent
|
|
|
|
def initialize(changes:, previous_revision:)
|
|
|
|
@changes = changes
|
|
|
|
@previous_revision = previous_revision
|
|
|
|
@public_move_changes, @private_move_changes = changes.filter { _1.op == :move }.partition { !_1.private? }
|
2023-04-26 15:01:46 +02:00
|
|
|
@delete_champ_warning = !total_dossiers.zero? && !@changes.all?(&:can_rebase?)
|
2022-12-23 14:05:39 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def total_dossiers
|
|
|
|
@total_dossiers ||= @previous_revision.dossiers
|
|
|
|
.visible_by_administration
|
|
|
|
.state_en_construction_ou_instruction
|
|
|
|
.size
|
|
|
|
end
|
|
|
|
end
|