Class: Decidim::InitiativesVote

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

Overview

Initiatives can be voted by users and supported by organizations.

Instance Method Summary collapse

Instance Method Details

#decrypted_metadataObject



41
42
43
# File '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 '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