Speed up importing watch history

pull/229/head
Omar Roth 6 years ago
parent 6ae5d489ec
commit c5d2a57206

@ -1228,13 +1228,10 @@ post "/data_control" do |env|
end end
end end
body["watch_history"]?.try &.as_a.each do |id| if body["watch_history"]?
id = id.as_s watched = user.watched + body["watch_history"].as_a.map { |a| a.as_s }
watched.uniq!
if !user.watched.includes? id PG_DB.exec("UPDATE users SET watched = $1 WHERE email = $2", watched, user.email)
PG_DB.exec("UPDATE users SET watched = array_append(watched,$1) WHERE email = $2", id, user.email)
user.watched << id
end
end end
if body["preferences"]? if body["preferences"]?

Loading…
Cancel
Save