From dc4c204600b50e81d994acd4efc283fed0778e46 Mon Sep 17 00:00:00 2001 From: Beastie MAC Date: Tue, 17 Dec 2019 14:50:46 +0200 Subject: [PATCH] Fix load option votes --- lib/tasks/load_division.rake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/tasks/load_division.rake b/lib/tasks/load_division.rake index 1a09dae..0f3d187 100755 --- a/lib/tasks/load_division.rake +++ b/lib/tasks/load_division.rake @@ -11,12 +11,18 @@ namespace :load_division do divisions.each do |d| date_vote = DateTime.parse(d[0]['date_vote']).strftime('%F') mps = Mp.where('? >= start_date and end_date >= ?', date, date).to_a.uniq(&:deputy_id) + if d[0]['option']=="Прийнятий" + option = "Прийнято" + else + option = "Не прийнято" + end + division = Division.find_or_create_by( date: date_vote, number: d[0]['number'], name: d[0]['name'], clock_time: DateTime.parse(d[0]['date_vote']).strftime('%T'), - result: d[0]['option'] + result: option ) division.votes.destroy_all d[1]['votes'].each do |v|