diff --git a/app/models/legislation/process/phase.rb b/app/models/legislation/process/phase.rb new file mode 100644 index 000000000..1b8482a9a --- /dev/null +++ b/app/models/legislation/process/phase.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class Legislation::Process::Phase + + def initialize(start_date, end_date) + @start_date = start_date + @end_date = end_date + end + + def enabled? + @start_date.present? && @end_date.present? + end + + def started? + enabled? && Date.current >= @start_date + end + + def open? + started? && Date.current <= @end_date + end + +end diff --git a/app/models/legislation/process/publication.rb b/app/models/legislation/process/publication.rb new file mode 100644 index 000000000..10110f0e7 --- /dev/null +++ b/app/models/legislation/process/publication.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class Legislation::Process::Publication + + def initialize(publication_date) + @publication_date = publication_date + end + + def enabled? + @publication_date.present? + end + + def started? + enabled? && Date.current >= @publication_date + end + + def open? + started? + end + +end