Class: Decidim::FileAuthorizationHandler::Status
- Inherits:
-
Object
- Object
- Decidim::FileAuthorizationHandler::Status
- Defined in:
- app/models/decidim/file_authorization_handler/status.rb
Overview
Provides information about the current status of the census data for a given organization
Instance Method Summary collapse
-
#count ⇒ Object
Returns the number of unique census.
-
#initialize(organization) ⇒ Status
constructor
A new instance of Status.
-
#last_import_at ⇒ Object
Returns the date of the last import.
Constructor Details
#initialize(organization) ⇒ Status
Returns a new instance of Status.
8 9 10 |
# File 'app/models/decidim/file_authorization_handler/status.rb', line 8 def initialize(organization) @organization = organization end |
Instance Method Details
#count ⇒ Object
Returns the number of unique census
20 21 22 23 24 |
# File 'app/models/decidim/file_authorization_handler/status.rb', line 20 def count @count ||= CensusDatum.inside(@organization) .distinct.count(:id_document) @count end |
#last_import_at ⇒ Object
Returns the date of the last import
13 14 15 16 17 |
# File 'app/models/decidim/file_authorization_handler/status.rb', line 13 def last_import_at @last ||= CensusDatum.inside(@organization) .order(created_at: :desc).first @last ? @last.created_at : nil end |