lib/ayadn/databases.rb in ayadn-2.0.7 vs lib/ayadn/databases.rb in ayadn-2.0.8

- old
+ new

@@ -67,11 +67,11 @@ end def self.add_to_blacklist(type, target) crashes = 0 begin - remove_from_blacklist(target) + remove_from_blacklist(type, target) @sql.transaction do |db_in_transaction| target.each do |element| insert_data = {} insert_data[":type"] = type insert_data[":content"] = element.downcase @@ -117,14 +117,14 @@ exit end end end - def self.remove_from_blacklist(target) + def self.remove_from_blacklist(type, target) crashes = 0 begin target.each do |el| - @sql.execute("DELETE FROM Blacklist WHERE content=(?)", [el.downcase]) + @sql.execute("DELETE FROM Blacklist WHERE type=(?) AND content=(?)", [type, el.downcase]) end rescue Amalgalite::SQLite3::Error => e if crashes < 2 crashes += 1 sleep(0.01)