Class: Decidim::InitiativesVote

Inherits:
ApplicationRecord show all
Includes:
TranslatableAttributes
Defined in:
decidim-initiatives/app/models/decidim/initiatives_vote.rb

Overview

Initiatives can be voted by users and supported by organizations.

Instance Method Summary collapse

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#decrypted_metadataObject


41
42
43
# File 'decidim-initiatives/app/models/decidim/initiatives_vote.rb', line 41

def 
  @decrypted_metadata ||=  ? encryptor.decrypt() : {}
end

#sha1Object

Public: Generates a hashed representation of the initiative support.

Used when exporting the votes as CSV.


34
35
36
37
38
39
# File 'decidim-initiatives/app/models/decidim/initiatives_vote.rb', line 34

def sha1
  title = translated_attribute(initiative.title)
  description = translated_attribute(initiative.description)

  Digest::SHA1.hexdigest "#{authorization_unique_id}#{title}#{description}"
end