Merge branch 'master' into 1786-poll_results
This commit is contained in:
@@ -2042,7 +2042,6 @@ table {
|
||||
// ------------
|
||||
|
||||
.activity {
|
||||
margin-bottom: $line-height * 2;
|
||||
|
||||
.accordion li {
|
||||
margin-bottom: $line-height / 2;
|
||||
@@ -2074,62 +2073,15 @@ table {
|
||||
}
|
||||
}
|
||||
|
||||
table {
|
||||
border: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
td {
|
||||
position: relative;
|
||||
|
||||
&:first-child {
|
||||
padding-left: $line-height * 1.5;
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
&::before {
|
||||
color: $brand;
|
||||
font-family: "icons" !important;
|
||||
font-size: rem-calc(24);
|
||||
left: 4px;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
.activity-comments td:first-child::before {
|
||||
content: 'e';
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.activity-debates td:first-child::before {
|
||||
content: 'i';
|
||||
top: 14px;
|
||||
}
|
||||
|
||||
.activity-proposals {
|
||||
|
||||
td:first-child::before {
|
||||
content: 'h';
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.retired {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
}
|
||||
|
||||
.activity-investment-projects td:first-child::before,
|
||||
.activity-ballot td:first-child::before {
|
||||
content: '\53';
|
||||
top: 10px;
|
||||
.retired {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
}
|
||||
|
||||
.public-interests {
|
||||
margin-top: $line-height;
|
||||
|
||||
.column {
|
||||
padding-left: 0;
|
||||
li {
|
||||
margin-right: $line-height / 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -364,10 +364,6 @@
|
||||
width: rem-calc(48);
|
||||
}
|
||||
|
||||
.edit-debate {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.debate-info,
|
||||
.proposal-info,
|
||||
.investment-project-info,
|
||||
|
||||
@@ -18,6 +18,8 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
||||
@booth_assignment = @poll.booth_assignments.includes(:recounts, :voters,
|
||||
officer_assignments: [officer: [:user]]).find(params[:id])
|
||||
@voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date}
|
||||
@partial_results = @booth_assignment.partial_results
|
||||
@recounts = @booth_assignment.recounts
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
module ShiftsHelper
|
||||
|
||||
def shift_vote_collection_dates(polls)
|
||||
date_options((start_date(polls)..end_date(polls)), Poll::Shift.tasks[:vote_collection])
|
||||
def shift_vote_collection_dates(booth, polls)
|
||||
date_options((start_date(polls)..end_date(polls)), Poll::Shift.tasks[:vote_collection], booth)
|
||||
end
|
||||
|
||||
def shift_recount_scrutiny_dates(polls)
|
||||
def shift_recount_scrutiny_dates(booth, polls)
|
||||
dates = polls.map(&:ends_at).map(&:to_date).sort.inject([]) do |total, date|
|
||||
initial_date = date < Date.current ? Date.current : date
|
||||
total << (initial_date..date + Poll::RECOUNT_DURATION).to_a
|
||||
end
|
||||
date_options(dates.flatten.uniq, Poll::Shift.tasks[:recount_scrutiny])
|
||||
date_options(dates.flatten.uniq, Poll::Shift.tasks[:recount_scrutiny], booth)
|
||||
end
|
||||
|
||||
def date_options(dates, task_id)
|
||||
valid_dates(dates, task_id).map { |date| [l(date, format: :long), l(date)] }
|
||||
def date_options(dates, task_id, booth)
|
||||
valid_dates(dates, task_id, booth).map { |date| [l(date, format: :long), l(date)] }
|
||||
end
|
||||
|
||||
def valid_dates(dates, task_id)
|
||||
dates.reject { |date| officer_shifts(task_id).include?(date) }
|
||||
def valid_dates(dates, task_id, booth)
|
||||
dates.reject { |date| officer_shifts(task_id, booth).include?(date) }
|
||||
end
|
||||
|
||||
def start_date(polls)
|
||||
@@ -35,7 +35,7 @@ module ShiftsHelper
|
||||
|
||||
private
|
||||
|
||||
def officer_shifts(task_id)
|
||||
@officer.shifts.where(task: task_id).map(&:date)
|
||||
def officer_shifts(task_id, booth)
|
||||
@officer.shifts.where(task: task_id, booth: booth).map(&:date)
|
||||
end
|
||||
end
|
||||
|
||||
12
app/views/admin/poll/booth_assignments/_results.html.erb
Normal file
12
app/views/admin/poll/booth_assignments/_results.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<div id="poll-resources">
|
||||
<h3><%= t("admin.results.index.title") %></h3>
|
||||
|
||||
<% if @partial_results.empty? %>
|
||||
<div class="callout primary margin-top">
|
||||
<%= t("admin.results.index.no_results") %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render "admin/poll/results/recount", resource: @booth_assignment %>
|
||||
<%= render "admin/poll/results/result" %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -17,9 +17,12 @@
|
||||
<li class="tabs-title">
|
||||
<%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %>
|
||||
</li>
|
||||
<li class="tabs-title is-active">
|
||||
<li class="tabs-title">
|
||||
<%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %>
|
||||
</li>
|
||||
<li class="tabs-title is-active">
|
||||
<%= link_to t("admin.poll_booth_assignments.show.results"), "#tab-results" %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tabs-panel" id="tab-officers">
|
||||
@@ -43,7 +46,7 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="tabs-panel is-active" id="tab-recounts">
|
||||
<div class="tabs-panel" id="tab-recounts">
|
||||
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
|
||||
|
||||
<table id="totals">
|
||||
@@ -55,8 +58,12 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-center" id="total_final"><%= total_recounts_by_booth(@booth_assignment) || '-' %></td>
|
||||
<td class="text-center" id="total_system"><%= @booth_assignment.voters.count %></td>
|
||||
<td class="text-center" id="total_final">
|
||||
<%= total_recounts_by_booth(@booth_assignment) || '-' %>
|
||||
</td>
|
||||
<td class="text-center" id="total_system">
|
||||
<%= @booth_assignment.voters.count %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -79,4 +86,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tabs-panel is-active" id="tab-results">
|
||||
<%= render "results" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
14
app/views/admin/poll/results/_recount.html.erb
Normal file
14
app/views/admin/poll/results/_recount.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<table class="margin">
|
||||
<thead>
|
||||
<th><%= t("admin.results.result.table_whites") %></th>
|
||||
<th><%= t("admin.results.result.table_nulls") %></th>
|
||||
<th><%= t("admin.results.result.table_total") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td id="white_results"><%= resource.recounts.sum(:white_amount) %></td>
|
||||
<td id="null_results"><%= resource.recounts.sum(:null_amount) %></td>
|
||||
<td id="total_results"><%= resource.recounts.sum(:total_amount) %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
21
app/views/admin/poll/results/_result.html.erb
Normal file
21
app/views/admin/poll/results/_result.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<% by_question = @partial_results.group_by(&:question_id) %>
|
||||
<% @poll.questions.each do |question| %>
|
||||
<h3><%= question.title %></h3>
|
||||
<table class="margin">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.results.result.table_answer") %></th>
|
||||
<th class="text-center"><%= t("admin.results.result.table_votes") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% question.question_answers.each_with_index do |answer, i| %>
|
||||
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
|
||||
<tr id="question_<%= question.id %>_<%= i %>_result">
|
||||
<td><%= answer.title %></td>
|
||||
<td class="text-center"><%= by_answer[answer.title].present? ? by_answer[answer.title].sum(&:amount) : 0 %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
20
app/views/admin/poll/results/_results_by_booth.html.erb
Normal file
20
app/views/admin/poll/results/_results_by_booth.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<h3><%= t("admin.results.results_by_booth.title") %></h3>
|
||||
<table class="margin" id="booth_assignment_results">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.results.results_by_booth.booth") %></th>
|
||||
<th class="text-center"><%= t("admin.results.results_by_booth.results") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @poll.booth_assignments.sort_by {|ba| ba.booth.name }.each do |booth_assignment| %>
|
||||
<tr id="booth_assignment_<%= booth_assignment.id %>_result">
|
||||
<td><%= booth_assignment.booth.name %></td>
|
||||
<td class="text-center">
|
||||
<%= link_to t("admin.results.results_by_booth.see_results"),
|
||||
admin_poll_booth_assignment_path(@poll, booth_assignment, anchor: "tab-results") %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -9,44 +9,8 @@
|
||||
<%= t("admin.results.index.no_results") %>
|
||||
</div>
|
||||
<% else %>
|
||||
|
||||
<table class="margin">
|
||||
<thead>
|
||||
<th><%= t("admin.results.index.table_whites") %></th>
|
||||
<th><%= t("admin.results.index.table_nulls") %></th>
|
||||
<th><%= t("admin.results.index.table_total") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td id="white_results"><%= @poll.recounts.sum(:white_amount) %></td>
|
||||
<td id="null_results"><%= @poll.recounts.sum(:null_amount) %></td>
|
||||
<td id="total_results"><%= @poll.recounts.sum(:total_amount) %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<% by_question = @partial_results.group_by(&:question_id) %>
|
||||
<% @poll.questions.each do |question| %>
|
||||
<h3><%= question.title %></h3>
|
||||
<table class="margin">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.results.index.table_answer") %></th>
|
||||
<th class="text-center"><%= t("admin.results.index.table_votes") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% question.question_answers.each_with_index do |answer, i| %>
|
||||
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
|
||||
<tr id="question_<%= question.id %>_<%= i %>_result">
|
||||
<td><%= answer.title %></td>
|
||||
<td class="text-center"><%= by_answer[answer.title].present? ? by_answer[answer.title].sum(&:amount) : 0 %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<%= render "recount", resource: @poll %>
|
||||
<%= render "result" %>
|
||||
<%= render "results_by_booth" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
<div class="small-12 medium-3 column">
|
||||
<label><%= t("admin.poll_shifts.new.date") %></label>
|
||||
<%= select 'shift[date]', 'vote_collection_date',
|
||||
options_for_select(shift_vote_collection_dates(@booth.polls.current_or_incoming)),
|
||||
options_for_select(shift_vote_collection_dates(@booth, @booth.polls.current_or_incoming)),
|
||||
{ prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false },
|
||||
class: 'js-shift-vote-collection-dates' %>
|
||||
<%= select 'shift[date]', 'recount_scrutiny_date',
|
||||
options_for_select(shift_recount_scrutiny_dates(@booth.polls.current_or_recounting_or_incoming)),
|
||||
options_for_select(shift_recount_scrutiny_dates(@booth, @booth.polls.current_or_recounting_or_incoming)),
|
||||
{ prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false },
|
||||
class: 'js-shift-recount-scrutiny-dates',
|
||||
|
||||
@@ -9,13 +9,6 @@
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= back_link_to %>
|
||||
|
||||
<% if current_user && @debate.editable_by?(current_user) %>
|
||||
<%= link_to edit_debate_path(@debate), class: 'edit-debate button success small float-right' do %>
|
||||
<span class="icon-edit"></span>
|
||||
<%= t("debates.show.edit_debate_link") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<h1><%= @debate.title %></h1>
|
||||
<% if @debate.conflictive? %>
|
||||
<div data-alert class="callout alert margin-top">
|
||||
@@ -47,6 +40,15 @@
|
||||
</div>
|
||||
|
||||
<aside class="small-12 medium-3 column">
|
||||
<% if current_user && @debate.editable_by?(current_user) %>
|
||||
<div class="sidebar-divider"></div>
|
||||
<h2><%= t("debates.show.author") %></h2>
|
||||
<%= link_to edit_debate_path(@debate), class: 'button hollow expanded' do %>
|
||||
<span class="icon-edit"></span>
|
||||
<%= t("debates.show.edit_debate_link") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="sidebar-divider"></div>
|
||||
<h2><%= t("votes.supports") %></h2>
|
||||
<div id="<%= dom_id(@debate) %>_votes">
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<td>
|
||||
<%= link_to budget_investment.title, budget_investment_path(budget_investment.budget, budget_investment) %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<td>
|
||||
<% if can? :destroy, budget_investment %>
|
||||
<%= link_to t('shared.delete'), budget_investment_path(budget_investment.budget, budget_investment),
|
||||
method: :delete, class: "button hollow alert" %>
|
||||
method: :delete, class: "button hollow alert expanded" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<table id="budget_investments_list" class="clear activity-budget-investments">
|
||||
<% @budget_investments.each do |budget_investment| %>
|
||||
<%= render "budget_investment", budget_investment: budget_investment %>
|
||||
<% end %>
|
||||
<table id="budget_investments_list" class="margin-top">
|
||||
<thead>
|
||||
<th scope="col"><%= t("users.show.budget_investments") %></th>
|
||||
<th scope="col"><%= t("users.show.actions") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @budget_investments.each do |budget_investment| %>
|
||||
<%= render "budget_investment", budget_investment: budget_investment %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @budget_investments %>
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
<table class="clear activity-comments">
|
||||
<% @comments.each do |comment| %>
|
||||
<tr id="comment_<%= comment.id %>">
|
||||
<td>
|
||||
<%= comment_commentable_title(comment) %>
|
||||
<br>
|
||||
<%= comment.body %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<table class="margin-top">
|
||||
<thead>
|
||||
<th scope="col"><%= t("users.show.comments") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @comments.each do |comment| %>
|
||||
<tr id="comment_<%= comment.id %>">
|
||||
<td>
|
||||
<%= comment_commentable_title(comment) %>
|
||||
<br>
|
||||
<%= comment.body %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @comments %>
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
<table class="clear activity-debates">
|
||||
<% @debates.each do |debate| %>
|
||||
<tr id="debate_<%= debate.id %>">
|
||||
<td>
|
||||
<%= link_to debate.title, debate %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<table class="margin-top">
|
||||
<thead>
|
||||
<th scope="col"><%= t("users.show.debates") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @debates.each do |debate| %>
|
||||
<tr id="debate_<%= debate.id %>">
|
||||
<td>
|
||||
<%= link_to debate.title, debate %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @debates %>
|
||||
@@ -3,15 +3,11 @@
|
||||
|
||||
<% if user.interests.any? %>
|
||||
|
||||
<% user.interests.in_groups_of(10, false) do |interests_group| %>
|
||||
<div class="small-4 column end">
|
||||
<ul class="no-bullet">
|
||||
<% interests_group.each do |interest| %>
|
||||
<li> <small><%= interest %></small> </li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<ul class="no-bullet tags">
|
||||
<% user.interests.each do |interest| %>
|
||||
<li class="inline-block"><span><%= interest %></span></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<% else %>
|
||||
|
||||
@@ -20,5 +16,4 @@
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tr id="proposal_<%= proposal.id %>">
|
||||
<td>
|
||||
<%= link_to proposal.title, proposal, proposal.retired? ? { class: 'retired' } : {} %>
|
||||
<td class="small-9">
|
||||
<strong><%= link_to proposal.title, proposal, proposal.retired? ? { class: 'retired' } : {} %></strong>
|
||||
<br>
|
||||
<%= proposal.summary %>
|
||||
</td>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<table class="clear activity-proposals">
|
||||
<% @proposals.each do |proposal| %>
|
||||
<%= render "proposal", proposal: proposal %>
|
||||
<% end %>
|
||||
<table class="margin-top">
|
||||
<thead>
|
||||
<th scope="col"><%= t("users.show.proposals") %></th>
|
||||
<th scope="col" colspan="2"><%= t("users.show.actions") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @proposals.each do |proposal| %>
|
||||
<%= render "proposal", proposal: proposal %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @proposals %>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<% if @activity_counts[filter] > 0 %>
|
||||
<% if @current_filter == filter %>
|
||||
<li class="active">
|
||||
<%= t("users.show.filters.#{filter}", count: @activity_counts[filter]) %>
|
||||
<h2><%= t("users.show.filters.#{filter}", count: @activity_counts[filter]) %></h2>
|
||||
</li>
|
||||
<% else %>
|
||||
<li>
|
||||
@@ -43,7 +43,9 @@
|
||||
|
||||
<%= render "activity_page" %>
|
||||
<% else %>
|
||||
<p><%= t('users.show.private_activity') %></p>
|
||||
<div class="callout warning margin">
|
||||
<%= t('users.show.private_activity') %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render 'interests', user: @user if valid_interests_access? %>
|
||||
|
||||
@@ -537,6 +537,7 @@ en:
|
||||
no_officers: "There are no officers for this booth"
|
||||
recounts: "Recounts"
|
||||
recounts_list: "Recount list for this booth"
|
||||
results: "Results"
|
||||
date: "Date"
|
||||
count_final: "Final recount (by officer)"
|
||||
count_by_system: "Votes (automatic)"
|
||||
@@ -647,11 +648,17 @@ en:
|
||||
index:
|
||||
title: "Results"
|
||||
no_results: "There are no results"
|
||||
result:
|
||||
table_whites: "Totally blank ballots"
|
||||
table_nulls: "Invalid ballots"
|
||||
table_total: "Total ballots"
|
||||
table_answer: Answer
|
||||
table_votes: Votes
|
||||
results_by_booth:
|
||||
booth: Booth
|
||||
results: Results
|
||||
see_results: See results
|
||||
title: "Results by booth"
|
||||
booths:
|
||||
index:
|
||||
title: "List of booths"
|
||||
|
||||
@@ -14,8 +14,8 @@ en:
|
||||
phone_number_label: Phone number
|
||||
public_activity_label: Keep my list of activities public
|
||||
public_interests_label: Keep my interests public
|
||||
public_interests_my_title_list: List of interests (Tags of elements you follow)
|
||||
public_interests_user_title_list: List of interests (Tags of elements this user follows)
|
||||
public_interests_my_title_list: List of interests (tags of elements you follow)
|
||||
public_interests_user_title_list: List of interests (tags of elements this user follows)
|
||||
public_interests_my_empty_list: You do not follow any elements yet.
|
||||
public_interests_user_empty_list: This user does not follow any elements yet.
|
||||
save_changes_submit: Save changes
|
||||
@@ -158,6 +158,7 @@ en:
|
||||
flag: This debate has been flagged as inappropriate by several users.
|
||||
login_to_comment: You must %{signin} or %{signup} to leave a comment.
|
||||
share: Share
|
||||
author: Author
|
||||
update:
|
||||
form:
|
||||
submit_button: Save changes
|
||||
@@ -707,7 +708,12 @@ en:
|
||||
deleted: Deleted
|
||||
deleted_debate: This debate has been deleted
|
||||
deleted_proposal: This proposal has been deleted
|
||||
deleted_budget_investment: This investment has been deleted
|
||||
deleted_budget_investment: This investment project has been deleted
|
||||
proposals: Proposals
|
||||
debates: Debates
|
||||
budget_investments: Budget investments
|
||||
comments: Comments
|
||||
actions: Actions
|
||||
filters:
|
||||
comments:
|
||||
one: 1 Comment
|
||||
@@ -726,7 +732,7 @@ en:
|
||||
other: "%{count} Following"
|
||||
no_activity: User has no public activity
|
||||
no_private_messages: "This user doesn't accept private messages."
|
||||
private_activity: This user decided to keep the activity list private
|
||||
private_activity: This user decided to keep the activity list private.
|
||||
send_private_message: "Send private message"
|
||||
proposals:
|
||||
send_notification: "Send notification"
|
||||
|
||||
@@ -405,7 +405,7 @@ es:
|
||||
admin: Menú de administración
|
||||
banner: Gestionar banners
|
||||
proposals_topics: Temas de propuestas
|
||||
poll_questions: Preguntas ciudadanas
|
||||
poll_questions: Preguntas de votaciones
|
||||
budgets: Presupuestos participativos
|
||||
geozones: Gestionar distritos
|
||||
hidden_comments: Comentarios ocultos
|
||||
@@ -537,6 +537,7 @@ es:
|
||||
no_officers: "No hay presidentes de mesa para esta urna"
|
||||
recounts: "Recuentos"
|
||||
recounts_list: "Lista de recuentos de esta urna"
|
||||
results: "Resultados"
|
||||
date: "Fecha"
|
||||
count_final: "Recuento final (presidente de mesa)"
|
||||
count_by_system: "Votos (automático)"
|
||||
@@ -577,12 +578,12 @@ es:
|
||||
error_on_question_added: "No se pudo asignar la pregunta"
|
||||
questions:
|
||||
index:
|
||||
title: "Preguntas ciudadanas"
|
||||
title: "Preguntas de votaciones"
|
||||
create: "Crear pregunta ciudadana"
|
||||
no_questions: "No hay ninguna pregunta ciudadana."
|
||||
filter_poll: "Filtrar por votación"
|
||||
select_poll: "Seleccionar votación"
|
||||
questions_tab: "Preguntas ciudadanas"
|
||||
questions_tab: "Preguntas"
|
||||
successful_proposals_tab: "Propuestas que han superado el umbral"
|
||||
create_question: "Crear pregunta para votación"
|
||||
table_proposal: "Propuesta"
|
||||
@@ -649,11 +650,17 @@ es:
|
||||
index:
|
||||
title: "Resultados"
|
||||
no_results: "No hay resultados"
|
||||
result:
|
||||
table_whites: Papeletas totalmente en blanco
|
||||
table_nulls: Papeletas nulas
|
||||
table_total: Papeletas totales
|
||||
table_answer: Respuesta
|
||||
table_votes: Votos
|
||||
results_by_booth:
|
||||
booth: Urna
|
||||
results: Resultados
|
||||
see_results: Ver resultados
|
||||
title: "Resultados por urna"
|
||||
booths:
|
||||
index:
|
||||
title: "Lista de urnas"
|
||||
|
||||
@@ -14,8 +14,8 @@ es:
|
||||
phone_number_label: Teléfono
|
||||
public_activity_label: Mostrar públicamente mi lista de actividades
|
||||
public_interests_label: Mostrar públicamente mis intereses
|
||||
public_interests_my_title_list: Lista de intereses (Etiquetas de los elementos que sigues)
|
||||
public_interests_user_title_list: Lista de intereses (Etiquetas de los elementos seguidos este usuario)
|
||||
public_interests_my_title_list: Lista de intereses (etiquetas de los elementos que sigues)
|
||||
public_interests_user_title_list: Lista de intereses (etiquetas de los elementos seguidos este usuario)
|
||||
public_interests_my_empty_list: Aún no sigues ningún elemento.
|
||||
public_interests_user_empty_list: Este usuario no sigue ningún elemento todavía.
|
||||
save_changes_submit: Guardar cambios
|
||||
@@ -158,6 +158,7 @@ es:
|
||||
flag: Este debate ha sido marcado como inapropiado por varios usuarios.
|
||||
login_to_comment: Necesitas %{signin} o %{signup} para comentar.
|
||||
share: Compartir
|
||||
author: Autor
|
||||
update:
|
||||
form:
|
||||
submit_button: Guardar cambios
|
||||
@@ -708,6 +709,11 @@ es:
|
||||
deleted_debate: Este debate ha sido eliminado
|
||||
deleted_proposal: Esta propuesta ha sido eliminada
|
||||
deleted_budget_investment: Esta propuesta de inversión ha sido eliminada
|
||||
proposals: Propuestas
|
||||
debates: Debates
|
||||
budget_investments: Proyectos de presupuestos participativos
|
||||
comments: Comentarios
|
||||
actions: Acciones
|
||||
filters:
|
||||
comments:
|
||||
one: 1 Comentario
|
||||
@@ -726,7 +732,7 @@ es:
|
||||
other: "%{count} Siguiendo"
|
||||
no_activity: Usuario sin actividad pública
|
||||
no_private_messages: "Este usuario no acepta mensajes privados."
|
||||
private_activity: Este usuario ha decidido mantener en privado su lista de actividades
|
||||
private_activity: Este usuario ha decidido mantener en privado su lista de actividades.
|
||||
send_private_message: "Enviar un mensaje privado"
|
||||
proposals:
|
||||
send_notification: "Enviar notificación"
|
||||
|
||||
@@ -640,6 +640,49 @@ print "Creating Poll Voters"
|
||||
Poll::Voter.create(poll: poll, user: user)
|
||||
end
|
||||
|
||||
puts " ✅"
|
||||
print "Creating Poll Recounts"
|
||||
|
||||
Poll.all.each do |poll|
|
||||
poll.booth_assignments.each do |booth_assignment|
|
||||
officer_assignment = poll.officer_assignments.first
|
||||
author = Poll::Officer.first.user
|
||||
|
||||
Poll::Recount.create!(officer_assignment: officer_assignment,
|
||||
booth_assignment: booth_assignment,
|
||||
author: author,
|
||||
date: poll.ends_at,
|
||||
white_amount: rand(0..10),
|
||||
null_amount: rand(0..10),
|
||||
total_amount: rand(100..9999),
|
||||
origin: "booth")
|
||||
end
|
||||
end
|
||||
|
||||
puts " ✅"
|
||||
print "Creating Poll Results"
|
||||
|
||||
Poll.all.each do |poll|
|
||||
poll.booth_assignments.each do |booth_assignment|
|
||||
officer_assignment = poll.officer_assignments.first
|
||||
author = Poll::Officer.first.user
|
||||
|
||||
poll.questions.each do |question|
|
||||
question.question_answers.each do |answer|
|
||||
Poll::PartialResult.create!(officer_assignment: officer_assignment,
|
||||
booth_assignment: booth_assignment,
|
||||
date: Date.current,
|
||||
question: question,
|
||||
answer: answer.title,
|
||||
author: author,
|
||||
amount: rand(999),
|
||||
origin: "booth")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
puts " ✅"
|
||||
print "Creating legislation processes"
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class RemovePollQuestionValidAnswers < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :poll_questions, :valid_answers
|
||||
end
|
||||
end
|
||||
@@ -711,7 +711,6 @@ ActiveRecord::Schema.define(version: 20171019095042) do
|
||||
t.integer "author_id"
|
||||
t.string "author_visible_name"
|
||||
t.string "title"
|
||||
t.string "valid_answers"
|
||||
t.integer "comments_count"
|
||||
t.datetime "hidden_at"
|
||||
t.datetime "created_at"
|
||||
|
||||
@@ -126,5 +126,104 @@ feature 'Admin booths assignments' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Results for a booth assignment' do
|
||||
poll = create(:poll)
|
||||
booth_assignment = create(:poll_booth_assignment, poll: poll)
|
||||
other_booth_assignment = create(:poll_booth_assignment, poll: poll)
|
||||
|
||||
question_1 = create(:poll_question, poll: poll)
|
||||
create(:poll_question_answer, title: 'Yes', question: question_1)
|
||||
create(:poll_question_answer, title: 'No', question: question_1)
|
||||
|
||||
question_2 = create(:poll_question, poll: poll)
|
||||
create(:poll_question_answer, title: 'Today', question: question_2)
|
||||
create(:poll_question_answer, title: 'Tomorrow', question: question_2)
|
||||
|
||||
create(:poll_partial_result,
|
||||
booth_assignment: booth_assignment,
|
||||
question: question_1,
|
||||
answer: 'Yes',
|
||||
amount: 11)
|
||||
|
||||
create(:poll_partial_result,
|
||||
booth_assignment: booth_assignment,
|
||||
question: question_1,
|
||||
answer: 'No',
|
||||
amount: 4)
|
||||
|
||||
create(:poll_partial_result,
|
||||
booth_assignment: booth_assignment,
|
||||
question: question_2,
|
||||
answer: 'Today',
|
||||
amount: 5)
|
||||
|
||||
create(:poll_partial_result,
|
||||
booth_assignment: booth_assignment,
|
||||
question: question_2,
|
||||
answer: 'Tomorrow',
|
||||
amount: 6)
|
||||
|
||||
create(:poll_partial_result,
|
||||
booth_assignment: other_booth_assignment,
|
||||
question: question_1,
|
||||
answer: 'Yes',
|
||||
amount: 9999)
|
||||
|
||||
create(:poll_recount,
|
||||
booth_assignment: booth_assignment,
|
||||
white_amount: 21,
|
||||
null_amount: 44,
|
||||
total_amount: 66)
|
||||
|
||||
create(:poll_recount,
|
||||
booth_assignment: other_booth_assignment,
|
||||
white_amount: 999,
|
||||
null_amount: 999,
|
||||
total_amount: 999)
|
||||
|
||||
visit admin_poll_booth_assignment_path(poll, booth_assignment)
|
||||
|
||||
click_link 'Results'
|
||||
|
||||
expect(page).to have_content(question_1.title)
|
||||
|
||||
within("#question_#{question_1.id}_0_result") do
|
||||
expect(page).to have_content("Yes")
|
||||
expect(page).to have_content(11)
|
||||
end
|
||||
|
||||
within("#question_#{question_1.id}_1_result") do
|
||||
expect(page).to have_content("No")
|
||||
expect(page).to have_content(4)
|
||||
end
|
||||
|
||||
expect(page).to have_content(question_2.title)
|
||||
|
||||
within("#question_#{question_2.id}_0_result") do
|
||||
expect(page).to have_content("Today")
|
||||
expect(page).to have_content(5)
|
||||
end
|
||||
|
||||
within("#question_#{question_2.id}_1_result") do
|
||||
expect(page).to have_content("Tomorrow")
|
||||
expect(page).to have_content(6)
|
||||
end
|
||||
|
||||
within('#white_results') { expect(page).to have_content('21') }
|
||||
within('#null_results') { expect(page).to have_content('44') }
|
||||
within('#total_results') { expect(page).to have_content('66') }
|
||||
end
|
||||
|
||||
scenario "No results" do
|
||||
poll = create(:poll)
|
||||
booth_assignment = create(:poll_booth_assignment, poll: poll)
|
||||
|
||||
visit admin_poll_booth_assignment_path(poll, booth_assignment)
|
||||
|
||||
click_link "Results"
|
||||
|
||||
expect(page).to have_content "There are no results"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -311,6 +311,43 @@ feature 'Admin polls' do
|
||||
within('#null_results') { expect(page).to have_content('44') }
|
||||
within('#total_results') { expect(page).to have_content('66') }
|
||||
end
|
||||
|
||||
scenario "Link to results by booth" do
|
||||
poll = create(:poll)
|
||||
booth_assignment1 = create(:poll_booth_assignment, poll: poll)
|
||||
booth_assignment2 = create(:poll_booth_assignment, poll: poll)
|
||||
|
||||
question = create(:poll_question, poll: poll)
|
||||
create(:poll_question_answer, title: 'Yes', question: question)
|
||||
create(:poll_question_answer, title: 'No', question: question)
|
||||
|
||||
create(:poll_partial_result,
|
||||
booth_assignment: booth_assignment1,
|
||||
question: question,
|
||||
answer: 'Yes',
|
||||
amount: 5)
|
||||
|
||||
create(:poll_partial_result,
|
||||
booth_assignment: booth_assignment2,
|
||||
question: question,
|
||||
answer: 'Yes',
|
||||
amount: 6)
|
||||
|
||||
visit admin_poll_path(poll)
|
||||
|
||||
click_link "Results"
|
||||
|
||||
expect(page).to have_link("See results", count: 2)
|
||||
|
||||
within("#booth_assignment_#{booth_assignment1.id}_result") do
|
||||
click_link "See results"
|
||||
end
|
||||
|
||||
expect(page).to have_content booth_assignment1.booth.name
|
||||
expect(page).to have_content "Results"
|
||||
expect(page).to have_content "Yes"
|
||||
expect(page).to have_content "5"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ feature 'Users' do
|
||||
@user.update(public_interests: true)
|
||||
visit user_path(@user)
|
||||
|
||||
expect(page).to have_content("List of interests (Tags of elements this user follows)")
|
||||
expect(page).to have_content("List of interests (tags of elements this user follows)")
|
||||
end
|
||||
|
||||
scenario 'Should display custom interests title when user is visiting own user page' do
|
||||
@@ -322,7 +322,7 @@ feature 'Users' do
|
||||
login_as(@user)
|
||||
visit user_path(@user)
|
||||
|
||||
expect(page).to have_content("List of interests (Tags of elements you follow)")
|
||||
expect(page).to have_content("List of interests (tags of elements you follow)")
|
||||
end
|
||||
|
||||
scenario 'Should display generic empty interests list message when visited user has not interests defined' do
|
||||
|
||||
@@ -35,7 +35,7 @@ describe UsersHelper do
|
||||
|
||||
investment.hide
|
||||
|
||||
expect(comment_commentable_title(comment)).to eq '<del>' + comment.commentable.title + '</del> <span class="small">(This investment has been deleted)</span>'
|
||||
expect(comment_commentable_title(comment)).to eq '<del>' + comment.commentable.title + '</del> <span class="small">(This investment project has been deleted)</span>'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user