Merge pull request #1866 from consul/1740#add_total_poll_recount

Add Total Ballot poll recount, remove it from results
This commit is contained in:
BertoCQ
2017-09-14 22:59:41 +02:00
committed by GitHub
23 changed files with 186 additions and 333 deletions

View File

@@ -42,7 +42,6 @@ Layout/DotPosition:
- 'app/controllers/admin/poll/officer_assignments_controller.rb'
- 'app/controllers/admin/poll/polls_controller.rb'
- 'app/controllers/admin/poll/recounts_controller.rb'
- 'app/controllers/officing/final_recounts_controller.rb'
- 'app/controllers/officing/residence_controller.rb'
- 'app/controllers/officing/results_controller.rb'
- 'app/models/poll/officer.rb'
@@ -191,7 +190,6 @@ Layout/MultilineMethodCallIndentation:
- 'app/controllers/admin/poll/officer_assignments_controller.rb'
- 'app/controllers/admin/poll/polls_controller.rb'
- 'app/controllers/admin/poll/recounts_controller.rb'
- 'app/controllers/officing/final_recounts_controller.rb'
- 'app/controllers/officing/residence_controller.rb'
- 'app/controllers/officing/results_controller.rb'
- 'app/models/poll/officer.rb'
@@ -289,6 +287,7 @@ Lint/StringConversionInInterpolation:
- 'app/models/poll/null_result.rb'
- 'app/models/poll/partial_result.rb'
- 'app/models/poll/white_result.rb'
- 'app/models/poll/total_result.rb'
# Offense count: 15
# Cop supports --auto-correct.
@@ -473,7 +472,6 @@ Style/ConditionalAssignment:
- 'app/controllers/admin/poll/questions_controller.rb'
- 'app/controllers/comments_controller.rb'
- 'app/controllers/management/spending_proposals_controller.rb'
- 'app/controllers/officing/final_recounts_controller.rb'
- 'app/controllers/spending_proposals_controller.rb'
- 'app/controllers/verification/sms_controller.rb'
- 'lib/graph_ql/api_types_creator.rb'
@@ -565,6 +563,7 @@ Style/MutableConstant:
- 'app/models/poll/null_result.rb'
- 'app/models/poll/partial_result.rb'
- 'app/models/poll/white_result.rb'
- 'app/models/poll/total_result.rb'
- 'app/models/proposal.rb'
- 'app/models/signature_sheet.rb'
- 'app/models/site_customization/content_block.rb'

View File

@@ -1,49 +0,0 @@
class Officing::FinalRecountsController < Officing::BaseController
before_action :load_poll
before_action :load_officer_assignment, only: :create
def new
@officer_assignments = ::Poll::OfficerAssignment.
includes(:final_recounts, booth_assignment: [:booth]).
joins(:booth_assignment).
final.
where(id: current_user.poll_officer.officer_assignment_ids).
where("poll_booth_assignments.poll_id = ?", @poll.id).
order(date: :asc)
@final_recounts = @officer_assignments.select {|oa| oa.final_recounts.any?}.map(&:final_recounts).flatten
end
def create
@final_recount = ::Poll::FinalRecount.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
date: final_recount_params[:date])
@final_recount.officer_assignment_id = @officer_assignment.id
@final_recount.count = final_recount_params[:count]
if @final_recount.save
msg = { notice: t("officing.final_recounts.flash.create") }
else
msg = { alert: t("officing.final_recounts.flash.error_create") }
end
redirect_to new_officing_poll_final_recount_path(@poll), msg
end
private
def load_poll
@poll = Poll.expired.find(params[:poll_id])
end
def load_officer_assignment
@officer_assignment = current_user.poll_officer.
officer_assignments.final.find_by(id: final_recount_params[:officer_assignment_id])
if @officer_assignment.blank?
redirect_to new_officing_poll_final_recount_path(@poll), alert: t("officing.final_recounts.flash.error_create")
end
end
def final_recount_params
params.permit(:officer_assignment_id, :count, :date)
end
end

View File

@@ -6,10 +6,11 @@ class Officing::PollsController < Officing::BaseController
end
def final
@polls = current_user.poll_officer? ? current_user.poll_officer.final_days_assigned_polls : []
return unless current_user.poll_officer?
@polls = @polls.select {|poll| poll.ends_at > 1.week.ago && poll.expired?}
@polls = if current_user.poll_officer?
current_user.poll_officer.final_days_assigned_polls.select {|poll| poll.ends_at > 1.week.ago && poll.expired?}
else
[]
end
end
end

View File

@@ -28,6 +28,7 @@ class Officing::ResultsController < Officing::BaseController
where(date: index_params[:date])
@whites = ::Poll::WhiteResult.where(booth_assignment_id: @booth_assignment.id, date: index_params[:date]).sum(:amount)
@nulls = ::Poll::NullResult.where(booth_assignment_id: @booth_assignment.id, date: index_params[:date]).sum(:amount)
@total = ::Poll::TotalResult.where(booth_assignment_id: @booth_assignment.id, date: index_params[:date]).sum(:amount)
end
end
@@ -70,6 +71,7 @@ class Officing::ResultsController < Officing::BaseController
build_white_results
build_null_results
build_total_results
end
def build_white_results
@@ -96,6 +98,18 @@ class Officing::ResultsController < Officing::BaseController
end
end
def build_total_results
if results_params[:total].present?
total_result = ::Poll::TotalResult.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
date: results_params[:date])
total_result.officer_assignment_id = @officer_assignment.id
total_result.amount = results_params[:total].to_i
total_result.author = current_user
total_result.origin = 'booth'
@results << total_result
end
end
def go_back_to_new(alert = nil)
params[:d] = results_params[:date]
params[:oa] = results_params[:officer_assignment_id]
@@ -132,7 +146,7 @@ class Officing::ResultsController < Officing::BaseController
end
def results_params
params.permit(:officer_assignment_id, :date, :questions, :whites, :nulls)
params.permit(:officer_assignment_id, :date, :questions, :whites, :nulls, :total)
end
def index_params

View File

@@ -4,6 +4,7 @@ class Poll < ActiveRecord::Base
has_many :partial_results, through: :booth_assignments
has_many :white_results, through: :booth_assignments
has_many :null_results, through: :booth_assignments
has_many :total_results, through: :booth_assignments
has_many :voters
has_many :officer_assignments, through: :booth_assignments
has_many :officers, through: :officer_assignments

View File

@@ -10,5 +10,6 @@ class Poll
has_many :partial_results
has_many :white_results
has_many :null_results
has_many :total_results
end
end

View File

@@ -0,0 +1,23 @@
class Poll::TotalResult < ActiveRecord::Base
VALID_ORIGINS = %w{web booth}
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :booth_assignment
belongs_to :officer_assignment
validates :author, presence: true
validates :origin, inclusion: {in: VALID_ORIGINS}
scope :by_author, ->(author_id) { where(author_id: author_id) }
before_save :update_logs
def update_logs
if amount_changed? && amount_was.present?
self.amount_log += ":#{amount_was.to_s}"
self.officer_assignment_id_log += ":#{officer_assignment_id_was.to_s}"
self.author_id_log += ":#{author_id_was.to_s}"
end
end
end

View File

@@ -14,11 +14,13 @@
<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.white_results.sum(:amount) %></td>
<td id="null_results"><%= @poll.null_results.sum(:amount) %></td>
<td id="total_results"><%= @poll.total_results.sum(:amount) %></td>
</tr>
</tbody>
</table>

View File

@@ -1,80 +0,0 @@
<% if @officer_assignments.any? %>
<h2><%= t("officing.final_recounts.new.title", poll: @poll.name) %></h2>
<%= form_tag(officing_poll_final_recounts_path(@poll), {id: "officer_assignment_form"}) do %>
<div class="row">
<div class="small-12 medium-6 column">
<label><%= t("officing.final_recounts.new.booth") %></label>
<%= select_tag :officer_assignment_id,
booths_for_officer_select_options(@officer_assignments),
{ prompt: t("officing.final_recounts.new.select_booth"),
label: false } %>
</div>
</div>
<div class="row">
<div class="small-12 medium-6 column">
<label><%= t("officing.final_recounts.new.date") %></label>
<%= select_tag :date,
poll_dates_select_options(@poll),
{ prompt: t("officing.final_recounts.new.select_date"),
label: false } %>
</div>
</div>
<div class="row">
<div class="small-12 medium-6 large-4 column">
<label><%= t("officing.final_recounts.new.count") %></label>
<%= text_field_tag :count, nil, placeholder: t("officing.final_recounts.new.count_placeholder") %>
</div>
</div>
<div class="row">
<div class="small-12 medium-6 large-4 column">
<%= submit_tag t("officing.final_recounts.new.submit"), class: "button expanded" %>
</div>
</div>
<% end %>
<% else %>
<h2><%= @poll.name %></h2>
<div class="callout alert">
<%= t("officing.final_recounts.new.not_allowed") %>
</div>
<% end %>
<% if @final_recounts.any? %>
<hr>
<h3><%= t("officing.final_recounts.new.final_recount_list") %></h3>
<table>
<thead>
<th><%= t("officing.final_recounts.new.date") %></th>
<th><%= t("officing.final_recounts.new.booth") %></th>
<th><%= t("officing.final_recounts.new.count") %></th>
<th><%= t("officing.final_recounts.new.system_count") %></th>
<th>&nbsp;</th>
</thead>
<tbody>
<% @final_recounts.each do |final_recount| %>
<tr id="<%= dom_id(final_recount) %>">
<td>
<%= l(final_recount.date.to_date, format: :long) %>
</td>
<td>
<%= final_recount.booth_assignment.booth.name %>
</td>
<td>
<strong><%= final_recount.count %></strong>
</td>
<td>
<strong><%= system_recount_to_compare_with_final_recount final_recount %></strong>
</td>
<td>
<%= link_to t("officing.final_recounts.new.add_results"), new_officing_poll_result_path(@poll, oa: final_recount.officer_assignment.id, d: l(final_recount.date.to_date) )%>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -14,9 +14,6 @@
</strong>
</td>
<td class="text-right">
<%= link_to t("officing.polls.final.add_recount"),
new_officing_poll_final_recount_path(poll),
class: "button hollow" %>
<%= link_to t("officing.polls.final.add_results"),
new_officing_poll_result_path(poll),
class: "button hollow" %>

View File

@@ -16,12 +16,14 @@
<tr>
<th><%= t("officing.results.index.table_whites") %></th>
<th><%= t("officing.results.index.table_nulls") %></th>
<th><%= t("officing.results.index.table_total") %></th>
</tr>
</thead>
<tbody>
<tr>
<td id="white_results"><%= @whites %></td>
<td id="null_results"><%= @nulls %></td>
<td id="total_results"><%= @total %></td>
</tr>
</tbody>
</table>

View File

@@ -47,6 +47,11 @@
<h3><%= t("officing.results.new.ballots_null") %></h3>
<%= text_field_tag :nulls, params[:nulls].presence, placeholder: "0" %>
</div>
<div class="small-12 medium-6 large-3 column end">
<h3><%= t("officing.results.new.ballots_total") %></h3>
<%= text_field_tag :total, params[:total].presence, placeholder: "0" %>
</div>
</div>
<hr>

View File

@@ -612,6 +612,7 @@ en:
no_results: "There are no results"
table_whites: "Blank ballots"
table_nulls: "Invalid ballots"
table_total: "Total ballots"
table_answer: Answer
table_votes: Votes
booths:

View File

@@ -15,25 +15,7 @@ en:
title: Polls ready for final recounting
no_polls: You are not officing final recounts in any active poll
select_poll: Select poll
add_recount: Add final recount
add_results: Add results
final_recounts:
flash:
create: "Data added"
error_create: "Final counts NOT added. Error in data."
new:
title: "%{poll} - Add final recount"
not_allowed: "You are allowed to add final recounts for this poll"
booth: "Booth"
date: "Date"
select_booth: "Select booth"
select_date: "Select date"
count: "Final vote count"
count_placeholder: "Final vote count"
submit: Save
final_recount_list: "Your final recounts"
system_count: "System recount"
add_results: "Add results"
results:
flash:
create: "Results saved"
@@ -49,6 +31,7 @@ en:
select_date: "Select date"
ballots_white: "Blank ballots"
ballots_null: "Invalid ballots"
ballots_total: "Total ballots"
submit: "Save"
results_list: "Your results"
see_results: "See results"
@@ -59,6 +42,7 @@ en:
table_votes: Votes
table_whites: "Blank ballots"
table_nulls: "Invalid ballots"
table_total: "Total ballots"
residence:
flash:
create: "Document verified with Census"

View File

@@ -612,6 +612,7 @@ es:
no_results: "No hay resultados"
table_whites: Papeletas en blanco
table_nulls: Papeletas nulas
table_total: Papeletas totales
table_answer: Respuesta
table_votes: Votos
booths:

View File

@@ -15,24 +15,6 @@ es:
title: "Listado de votaciones finalizadas"
no_polls: "No tienes permiso para recuento final en ninguna votación reciente"
select_poll: "Selecciona votación"
add_recount: "Añadir recuentos finales"
add_results: "Añadir resultados"
final_recounts:
flash:
create: "Datos añadidos"
error_create: "Recuento final NO añadido. Error en los datos"
new:
title: "%{poll} - Añadir recuento final"
not_allowed: "No tienes permiso para introducir recountos finales"
booth: "Urna"
date: "Día"
select_booth: "Elige urna"
select_date: "Elige día"
count: "Recuento final"
count_placeholder: "Número final de votos"
submit: "Guardar"
final_recount_list: "Tus recuentos finales"
system_count: "Recuento del sistema"
add_results: "Añadir resultados"
results:
flash:
@@ -49,6 +31,7 @@ es:
select_date: "Elige día"
ballots_white: "Papeletas en blanco"
ballots_null: "Papeletas nulas"
ballots_total: "Papeletas totales"
submit: "Guardar"
results_list: "Tus resultados"
see_results: "Ver resultados"
@@ -59,6 +42,7 @@ es:
table_votes: Votos
table_whites: Papeletas en blanco
table_nulls: Papeletas nulas
table_total: Papeletas totales
residence:
flash:
create: "Documento verificado con el Padrón"

View File

@@ -420,7 +420,6 @@ Rails.application.routes.draw do
resources :polls, only: [:index] do
get :final, on: :collection
resources :final_recounts, only: [:new, :create]
resources :results, only: [:new, :create, :index]
end
resource :residence, controller: "residence", only: [:new, :create]

View File

@@ -0,0 +1,18 @@
class CreatePollTotalResults < ActiveRecord::Migration
def change
create_table :poll_total_results do |t|
t.integer :author_id
t.integer :amount
t.string :origin
t.date :date
t.integer :booth_assignment_id
t.integer :officer_assignment_id
t.text :amount_log, default: ""
t.text :officer_assignment_id_log, default: ""
t.text :author_id_log, default: ""
end
add_index :poll_total_results, :officer_assignment_id
add_index :poll_total_results, :booth_assignment_id
end
end

View File

@@ -691,6 +691,21 @@ ActiveRecord::Schema.define(version: 20170914154743) do
add_index "poll_shifts", ["booth_id"], name: "index_poll_shifts_on_booth_id", using: :btree
add_index "poll_shifts", ["officer_id"], name: "index_poll_shifts_on_officer_id", using: :btree
create_table "poll_total_results", force: :cascade do |t|
t.integer "author_id"
t.integer "amount"
t.string "origin"
t.date "date"
t.integer "booth_assignment_id"
t.integer "officer_assignment_id"
t.text "amount_log", default: ""
t.text "officer_assignment_id_log", default: ""
t.text "author_id_log", default: ""
end
add_index "poll_total_results", ["booth_assignment_id"], name: "index_poll_total_results_on_booth_assignment_id", using: :btree
add_index "poll_total_results", ["officer_assignment_id"], name: "index_poll_total_results_on_officer_assignment_id", using: :btree
create_table "poll_voters", force: :cascade do |t|
t.string "document_number"
t.string "document_type"

View File

@@ -556,6 +556,11 @@ FactoryGirl.define do
origin { 'web' }
end
factory :poll_total_result, class: 'Poll::TotalResult' do
association :author, factory: :user
origin { 'web' }
end
factory :officing_residence, class: 'Officing::Residence' do
user
association :officer, factory: :poll_officer

View File

@@ -1,149 +0,0 @@
require 'rails_helper'
feature 'Officing Final Recount' do
background do
@poll_officer = create(:poll_officer)
@officer_assignment = create(:poll_officer_assignment, :final, officer: @poll_officer)
@poll = @officer_assignment.booth_assignment.poll
@poll.update(ends_at: 1.day.ago)
login_as(@poll_officer.user)
end
scenario 'Only polls where user is officer for final recounts are accessible' do
regular_officer_assignment_1 = create(:poll_officer_assignment, officer: @poll_officer)
regular_officer_assignment_2 = create(:poll_officer_assignment, officer: @poll_officer)
not_allowed_poll_1 = create(:poll, :expired)
not_allowed_poll_2 = regular_officer_assignment_1.booth_assignment.poll
not_allowed_poll_2.update(ends_at: 1.day.ago)
not_allowed_poll_3 = regular_officer_assignment_2.booth_assignment.poll
visit root_path
click_link 'Polling officers'
expect(page).to have_content('Poll officing')
within('#side_menu') do
click_link 'Final recounts and results'
end
expect(page).to_not have_content(not_allowed_poll_1.name)
expect(page).to_not have_content(not_allowed_poll_2.name)
expect(page).to_not have_content(not_allowed_poll_3.name)
expect(page).to have_content(@poll.name)
visit new_officing_poll_final_recount_path(not_allowed_poll_1)
expect(page).to have_content('You are allowed to add final recounts for this poll')
end
scenario 'Add final recount' do
visit officing_root_path
within('#side_menu') do
click_link 'Final recounts and results'
end
within("#poll_#{@poll.id}") do
expect(page).to have_content(@poll.name)
click_link 'Add final recount'
end
expect(page).to_not have_content('Your recounts')
booth_name = @officer_assignment.booth_assignment.booth.name
date = I18n.l(@poll.starts_at.to_date, format: :long)
select booth_name, from: 'officer_assignment_id'
select date, from: 'date'
fill_in :count, with: '33'
click_button 'Save'
expect(page).to have_content('Your final recounts')
within("#poll_final_recount_#{@officer_assignment.booth_assignment.final_recounts.first.id}") do
expect(page).to have_content(date)
expect(page).to have_content(booth_name)
expect(page).to have_content('33')
end
end
scenario 'Edit final recount' do
final_recount = create(:poll_final_recount,
officer_assignment: @officer_assignment,
booth_assignment: @officer_assignment.booth_assignment,
date: @poll.starts_at,
count: 100)
booth_name = @officer_assignment.booth_assignment.booth.name
date = I18n.l(final_recount.date.to_date, format: :long)
visit new_officing_poll_final_recount_path(@poll)
expect(page).to have_content('Your final recounts')
within("#poll_final_recount_#{final_recount.id}") do
expect(page).to have_content(date)
expect(page).to have_content(booth_name)
expect(page).to have_content('100')
end
select booth_name, from: 'officer_assignment_id'
select date, from: 'date'
fill_in :count, with: '42'
click_button 'Save'
expect(page).to have_content "Data added"
within("#poll_final_recount_#{final_recount.id}") do
expect(page).to have_content(date)
expect(page).to have_content(booth_name)
expect(page).to have_content('42')
end
expect(page).to_not have_content('100')
end
scenario 'Show final and system recounts to compare' do
final_officer_assignment = create(:poll_officer_assignment, :final, officer: @poll_officer)
poll = final_officer_assignment.booth_assignment.poll
poll.update(ends_at: 1.day.ago)
final_recount = create(:poll_final_recount,
officer_assignment: final_officer_assignment,
booth_assignment: final_officer_assignment.booth_assignment,
date: 7.days.ago,
count: 100)
33.times do
create(:poll_voter, :valid_document,
poll: poll,
booth_assignment: final_officer_assignment.booth_assignment,
created_at: final_recount.date)
end
visit new_officing_poll_final_recount_path(poll)
within("#poll_final_recount_#{final_recount.id}") do
expect(page).to have_content(I18n.l(final_recount.date.to_date, format: :long))
expect(page).to have_content(final_officer_assignment.booth_assignment.booth.name)
expect(page).to have_content('100')
expect(page).to have_content('33')
end
end
scenario "Show link to add results for same booth/date" do
final_officer_assignment = create(:poll_officer_assignment, :final, officer: @poll_officer)
poll = final_officer_assignment.booth_assignment.poll
poll.update(ends_at: 1.day.ago)
final_recount = create(:poll_final_recount,
officer_assignment: final_officer_assignment,
booth_assignment: final_officer_assignment.booth_assignment,
date: 7.days.ago,
count: 100)
visit new_officing_poll_final_recount_path(poll)
within("#poll_final_recount_#{final_recount.id}") do
click_link "Add results"
end
expected_path = new_officing_poll_result_path(poll, oa: final_recount.officer_assignment.id, d: I18n.l(final_recount.date.to_date))
expect(page).to have_current_path(expected_path)
expect(page).to have_select('officer_assignment_id', selected: final_recount.booth_assignment.booth.name)
expect(page).to have_select('date', selected: I18n.l(final_recount.date.to_date, format: :long))
end
end

View File

@@ -65,6 +65,7 @@ feature 'Officing Results' do
fill_in "whites", with: '66'
fill_in "nulls", with: '77'
fill_in "total", with: '88'
click_button 'Save'
@@ -101,6 +102,7 @@ feature 'Officing Results' do
fill_in "questions[#{@question_1.id}][1]", with: '200'
fill_in "whites", with: '6'
fill_in "nulls", with: '7'
fill_in "total", with: '8'
click_button 'Save'
@@ -113,6 +115,7 @@ feature 'Officing Results' do
expect(page).to_not have_content('7777')
within("#white_results") { expect(page).to have_content('6') }
within("#null_results") { expect(page).to have_content('7') }
within("#total_results") { expect(page).to have_content('8') }
within("#question_#{@question_1.id}_0_result") { expect(page).to have_content('5555') }
within("#question_#{@question_1.id}_1_result") { expect(page).to have_content('200') }
end
@@ -134,6 +137,11 @@ feature 'Officing Results' do
booth_assignment: @officer_assignment.booth_assignment,
date: @poll.ends_at,
amount: 44)
total_result = create(:poll_total_result,
officer_assignment: @officer_assignment,
booth_assignment: @officer_assignment.booth_assignment,
date: @poll.ends_at,
amount: 66)
visit officing_poll_results_path(@poll,
date: I18n.l(@poll.ends_at.to_date),
@@ -154,6 +162,7 @@ feature 'Officing Results' do
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
end

View File

@@ -0,0 +1,70 @@
require 'rails_helper'
describe Poll::TotalResult do
describe "logging changes" do
it "should update amount_log if amount changes" do
total_result = create(:poll_total_result, amount: 33)
expect(total_result.amount_log).to eq("")
total_result.amount = 33
total_result.save
total_result.amount = 32
total_result.save
total_result.amount = 34
total_result.save
expect(total_result.amount_log).to eq(":33:32")
end
it "should update officer_assignment_id_log if amount changes" do
total_result = create(:poll_total_result, amount: 33)
expect(total_result.amount_log).to eq("")
expect(total_result.officer_assignment_id_log).to eq("")
total_result.amount = 33
total_result.officer_assignment = create(:poll_officer_assignment, id: 101)
total_result.save
total_result.amount = 32
total_result.officer_assignment = create(:poll_officer_assignment, id: 102)
total_result.save
total_result.amount = 34
total_result.officer_assignment = create(:poll_officer_assignment, id: 103)
total_result.save
expect(total_result.amount_log).to eq(":33:32")
expect(total_result.officer_assignment_id_log).to eq(":101:102")
end
it "should update author_id if amount changes" do
total_result = create(:poll_total_result, amount: 33)
expect(total_result.amount_log).to eq("")
expect(total_result.author_id_log).to eq("")
author_A = create(:poll_officer).user
author_B = create(:poll_officer).user
author_C = create(:poll_officer).user
total_result.amount = 33
total_result.author_id = author_A.id
total_result.save!
total_result.amount = 32
total_result.author_id = author_B.id
total_result.save!
total_result.amount = 34
total_result.author_id = author_C.id
total_result.save!
expect(total_result.amount_log).to eq(":33:32")
expect(total_result.author_id_log).to eq(":#{author_A.id}:#{author_B.id}")
end
end
end