Use single db call

This commit is contained in:
Brahim Hadriche 2023-03-04 19:14:28 -05:00
parent 20289a4d01
commit 025e755542

View file

@ -50,10 +50,9 @@ module Invidious::Database::Users
end end
def mark_watched(user : User, vid : String) def mark_watched(user : User, vid : String)
mark_unwatched(user, vid)
request = <<-SQL request = <<-SQL
UPDATE users UPDATE users
SET watched = array_append(watched, $1) SET watched = array_append(array_remove(watched, $1), $1)
WHERE email = $2 WHERE email = $2
SQL SQL