Merge pull request #2616 from consul/show_votes_associated_to_signatures

Show count of votes associated to verified signatures
This commit is contained in:
Javier Martín
2019-05-31 15:30:04 +02:00
committed by GitHub
5 changed files with 24 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ class Admin::SignatureSheetsController < Admin::BaseController
def show def show
@signature_sheet = SignatureSheet.find(params[:id]) @signature_sheet = SignatureSheet.find(params[:id])
@voted_signatures = Vote.where(signature: @signature_sheet.signatures.verified).count
end end
private private

View File

@@ -24,6 +24,12 @@
<%= t("admin.signature_sheets.show.verified", <%= t("admin.signature_sheets.show.verified",
count: @signature_sheet.signatures.verified.count ) %> count: @signature_sheet.signatures.verified.count ) %>
</strong> </strong>
<br />
<strong>
<%= t("admin.signature_sheets.show.voted",
count: @voted_signatures) %>
</strong>
</div> </div>
<div id="unverified_signatures" class="callout alert"> <div id="unverified_signatures" class="callout alert">

View File

@@ -1437,6 +1437,10 @@ en:
one: "There is %{count} invalid signature" one: "There is %{count} invalid signature"
other: "There are %{count} invalid signatures" other: "There are %{count} invalid signatures"
unverified_error: (Not verified by Census) unverified_error: (Not verified by Census)
voted:
zero: "There is no votes created from the verified signatures."
one: "There is %{count} vote created from the verified signatures."
other: "There is %{count} votes created from verified signatures."
loading: "There are still signatures that are being verified by the Census, please refresh the page in a few moments" loading: "There are still signatures that are being verified by the Census, please refresh the page in a few moments"
stats: stats:
show: show:

View File

@@ -1436,6 +1436,10 @@ es:
one: "Hay %{count} firma inválida" one: "Hay %{count} firma inválida"
other: "Hay %{count} firmas inválidas" other: "Hay %{count} firmas inválidas"
unverified_error: (No verificadas por el Padrón) unverified_error: (No verificadas por el Padrón)
voted:
zero: "No hay votos asociados con las firmas verificadas."
one: "Hay %{count} voto asociado a las firmas verificadas."
other: "Hay %{count} votos asociados a las firmas verificadas."
loading: "Aún hay firmas que se están verificando por el Padrón, por favor refresca la página en unos instantes" loading: "Aún hay firmas que se están verificando por el Padrón, por favor refresca la página en unos instantes"
stats: stats:
show: show:

View File

@@ -39,10 +39,13 @@ describe "Signature sheets" do
select "Citizen proposal", from: "signature_sheet_signable_type" select "Citizen proposal", from: "signature_sheet_signable_type"
fill_in "signature_sheet_signable_id", with: proposal.id fill_in "signature_sheet_signable_id", with: proposal.id
fill_in "signature_sheet_document_numbers", with: "12345678Z, 99999999Z" fill_in "signature_sheet_document_numbers", with: "12345678Z, 1234567L, 99999999Z"
click_button "Create signature sheet" click_button "Create signature sheet"
expect(page).to have_content "Signature sheet created successfully" expect(page).to have_content "Signature sheet created successfully"
expect(page).to have_content "There is 1 valid signature"
expect(page).to have_content "There is 1 vote created from the verified signatures"
expect(page).to have_content "There are 2 invalid signatures"
visit proposal_path(proposal) visit proposal_path(proposal)
@@ -58,10 +61,13 @@ describe "Signature sheets" do
select "Investment", from: "signature_sheet_signable_type" select "Investment", from: "signature_sheet_signable_type"
fill_in "signature_sheet_signable_id", with: investment.id fill_in "signature_sheet_signable_id", with: investment.id
fill_in "signature_sheet_document_numbers", with: "12345678Z, 99999999Z" fill_in "signature_sheet_document_numbers", with: "12345678Z, 1234567L, 99999999Z"
click_button "Create signature sheet" click_button "Create signature sheet"
expect(page).to have_content "Signature sheet created successfully" expect(page).to have_content "Signature sheet created successfully"
expect(page).to have_content "There is 1 valid signature"
expect(page).to have_content "There is 1 vote created from the verified signatures"
expect(page).to have_content "There are 2 invalid signatures"
visit budget_investment_path(budget, investment) visit budget_investment_path(budget, investment)
@@ -107,4 +113,4 @@ describe "Signature sheets" do
end end
end end
end end