Skip to content

Commit

Permalink
more corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Dec 13, 2023
1 parent 8b07c60 commit 1e75180
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/jobs/decidim/vocdoni/admin/create_voter_wallets_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def perform(election_id)
if voter.save
ok += 1
else
Rails.logger.error "CreateVoterWalletsJob: Error updaing the private key for voter #{voter.id}"
Rails.logger.error "CreateVoterWalletsJob: Error updating the private key for voter #{voter.id}"
end
end
Rails.logger.info "CreateVoterWalletsJob: Succesfully processed #{ok} voters. #{count - ok} errors for election #{election_id}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def perform(election_id)

Rails.logger.info "SaveVocdoniElectionResultsJob: Saving results for election #{election_id} at Vocdoni env #{Decidim::Vocdoni.api_endpoint_env}"

# json format
begin
@metadata = sdk.electionMetadata
update_results
Expand Down
3 changes: 3 additions & 0 deletions app/jobs/decidim/vocdoni/admin/sdk_runner_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module Decidim
module Vocdoni
module Admin
class SdkRunnerJob < VocdoniSdkBaseJob
# @param organization_id [Integer]
# @param command [String]
# @param election_id [Integer]
def perform(organization_id:, command:, election_id: nil)
@organization_id = organization_id
@election_id = election_id
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/decidim/vocdoni/admin/vocdoni_sdk_base_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def perform(election_id)

private

# don't memoize this, we need a new instance always to ensure the election is updated
# Don't memoize this, we need a new instance always to ensure the election is updated
def sdk
Sdk.new(organization, election)
end
Expand Down
9 changes: 5 additions & 4 deletions app/models/concerns/decidim/vocdoni/vocdoni_api_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ module Vocdoni
module VocdoniApiUtils
# Transform the locales to the required format with a default locale
#
# receives an array with the following format:
# [{"text": "Nom", "locale": "ca"}, {"text": "Name","locale": "en"}]
# @param translations [Array] An array with the following format:
# [{"text": "Nom", "locale": "ca"},
# {"text": "Name","locale": "en"}]
#
# @returns {object} An object with the following format:
# {ca: "Nom", default: "Name"}
# @return [Hash] A hash with the following format:
# {ca: "Nom", en: "Name", default: "Name"}
def transform_locales(translations)
values = {}
organization.available_locales.each do |locale|
Expand Down
2 changes: 1 addition & 1 deletion app/models/decidim/vocdoni/election.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def answers_have_values?
questions.map(&:answers).flatten.pluck(:value).none? nil
end

# Public: Checks if theres votes set in the answers
# Public: Checks if there are votes set in the answers
def answers_have_votes?
questions.map(&:answers).flatten.pluck(:votes).any? Integer
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/decidim/vocdoni/sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NodeError < NodeRunnerError; end

# Debug all HTTP calls to a file
class Executor < NodeRunner::Executor
# uncomment to debug all http calls into development_app/node_debug.log
# Set the env DECIDIM_VOCDONI_SDK_DEBUG=1 to debug all http calls into development_app/node_debug.log
def exec(filename)
return super(filename) unless ENV.fetch("DECIDIM_VOCDONI_SDK_DEBUG", false)

Expand Down
4 changes: 2 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ en:
more participants), its necessary to first delete all census data.
percentage_complete: Completed %{percentage}% of %{count} total records.
processing_html: The census is curently being processed for its use in
the blockchain. Once it's ready, you will be able to create the election.
the Blockchain. Once it's ready, you will be able to create the election.
ready_to_setup_html: The census data is uploaded and prepared for its
use in the Vocdoni blockchain.
use in the Vocdoni Blockchain.
title: Current census data
election_calendar:
edit:
Expand Down

0 comments on commit 1e75180

Please sign in to comment.