Simplify budget stats in voting phase

So we only show the total number of participants, and not divided by web
participants and booth participants.
This commit is contained in:
Javi Martín
2019-03-15 07:59:18 +01:00
parent d42454a1a8
commit dc077bb03c
5 changed files with 4 additions and 55 deletions

View File

@@ -6,8 +6,7 @@ class Budget::Stats
super +
%i[total_participants_support_phase total_participants_vote_phase
total_budget_investments total_votes total_selected_investments
total_unfeasible_investments total_supports headings
total_participants_web total_participants_booths]
total_unfeasible_investments headings]
end
def participants
@@ -24,14 +23,6 @@ class Budget::Stats
voters.uniq.count
end
def total_participants_web
(balloters - poll_ballot_voters).uniq.compact.count
end
def total_participants_booths
poll_ballot_voters.uniq.count
end
def total_participants_vote_phase
(balloters + poll_ballot_voters).uniq.count
end
@@ -52,10 +43,6 @@ class Budget::Stats
budget.investments.unfeasible.count
end
def total_supports
supports(budget).count
end
def authors
budget.investments.pluck(:author_id)
end

View File

@@ -82,13 +82,9 @@
<h4><%= t("stats.budgets.by_phase") %></h4>
<%= number_with_info_tags(@stats[:total_participants_support_phase],
t("stats.budgets.participants")) %>
<%= number_with_info_tags(@stats[:total_supports], t("stats.budgets.supports")) %>
<%= number_with_info_tags(@stats[:total_participants_web],
t("stats.budgets.total_participants_web")) %>
<%= number_with_info_tags(@stats[:total_participants_booths],
t("stats.budgets.total_participants_booths")) %>
t("stats.budgets.participants_support_phase")) %>
<%= number_with_info_tags(@stats[:total_participants_vote_phase],
t("stats.budgets.participants_voting_phase")) %>
</div>

View File

@@ -23,10 +23,6 @@ en:
total_selected_investments: "Projects in final voting phase"
total_unfeasible_investments: "Unfeasible projects"
by_phase: "Participants by phase"
total_participants_web: "Vote phase web participants"
total_participants_booths: "Vote phase booth participants"
participants: "Participants"
supports: "Supports"
by_heading: "Participants by phase and heading"
total: "Total"
heading: "Heading"

View File

@@ -23,10 +23,6 @@ es:
total_selected_investments: "Proyectos en la fase final"
total_unfeasible_investments: "Proyectos inviables"
by_phase: "Participación por fases"
total_participants_web: "Participantes web en votación final"
total_participants_booths: "Participantes en urnas votación final"
participants: "Participantes"
supports: "Apoyos"
by_heading: "Participación por distritos y fase"
total: "Total"
heading: "Distrito"

View File

@@ -94,24 +94,6 @@ describe Budget::Stats do
end
end
describe "#total_participants_web" do
it "returns the number of total participants in the votes phase via web" do
2.times { create(:budget_ballot_line, investment: investment) }
create(:poll_voter, :from_booth, budget: budget)
expect(stats.generate[:total_participants_web]).to be 2
end
end
describe "#total_participants_booths" do
it "returns the number of total participants in the votes phase in booths" do
2.times { create(:poll_voter, :from_booth, budget: budget) }
create(:budget_ballot_line, investment: investment)
expect(stats.generate[:total_participants_booths]).to be 2
end
end
describe "#total_budget_investments" do
it "returns the number of total budget investments" do
2.times { create(:budget_investment, budget: budget) }
@@ -150,14 +132,6 @@ describe Budget::Stats do
end
end
describe "#total_supports" do
it "returns the number of total supports" do
2.times { create(:vote, votable: investment) }
expect(stats.generate[:total_supports]).to be 2
end
end
describe "Participants by gender" do
before do
3.times { create(:user, gender: "male") }