Skip to content

Commit

Permalink
Fix load option votes
Browse files Browse the repository at this point in the history
  • Loading branch information
beastie87 committed Dec 17, 2019
1 parent 121f92b commit dc4c204
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/tasks/load_division.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit dc4c204

Please sign in to comment.