mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:29:30 +08:00
Fix MigratePollsData
failing when poll-votes have duplicated options.
This commit is contained in:
parent
f4020d9134
commit
439b3fe10a
|
@ -134,7 +134,10 @@ class MigratePollsData < ActiveRecord::Migration[5.2]
|
|||
options
|
||||
.select { |o| option_ids.has_key?(o) }
|
||||
.map { |o| "(#{poll_id}, #{option_ids[o]}, #{user_id.to_i}, '#{r.created_at}', '#{r.updated_at}')" }
|
||||
end.flatten
|
||||
end
|
||||
|
||||
poll_votes.flatten!
|
||||
poll_votes.uniq!
|
||||
|
||||
if poll_votes.present?
|
||||
execute <<~SQL
|
||||
|
|
|
@ -90,7 +90,8 @@ RSpec.describe MigratePollsData do
|
|||
"1" => {
|
||||
"testing" => [
|
||||
"b2c3e3668a886d09e97e38b8adde7d45",
|
||||
"28df49fa9e9c09d3a1eb8cfbcdcda7790",
|
||||
"b2c3e3668a886d09e97e38b8adde7d45",
|
||||
"28df49fa9e9c09d3a1eb8cfbcdcda7790"
|
||||
]
|
||||
},
|
||||
"2" => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user