rubocop: fix various Rubocop warnings.
This commit is contained in:
@@ -32,22 +32,18 @@ class ArtistVersion < ApplicationRecord
|
||||
extend SearchMethods
|
||||
|
||||
def previous
|
||||
@previous ||= begin
|
||||
ArtistVersion.where("artist_id = ? and created_at < ?", artist_id, created_at).order("created_at desc").limit(1).to_a
|
||||
end
|
||||
@previous ||= ArtistVersion.where("artist_id = ? and created_at < ?", artist_id, created_at).order("created_at desc").limit(1).to_a
|
||||
@previous.first
|
||||
end
|
||||
|
||||
def subsequent
|
||||
@subsequent ||= begin
|
||||
ArtistVersion.where("artist_id = ? and created_at > ?", artist_id, created_at).order("created_at asc").limit(1).to_a
|
||||
end
|
||||
@subsequent ||= ArtistVersion.where("artist_id = ? and created_at > ?", artist_id, created_at).order("created_at asc").limit(1).to_a
|
||||
@subsequent.first
|
||||
end
|
||||
|
||||
def current
|
||||
@previous ||= begin
|
||||
ArtistVersion.where("artist_id = ?", artist_id).order("created_at desc").limit(1).to_a
|
||||
ArtistVersion.where(artist_id: artist_id).order("created_at desc").limit(1).to_a
|
||||
end
|
||||
@previous.first
|
||||
end
|
||||
@@ -66,17 +62,17 @@ class ArtistVersion < ApplicationRecord
|
||||
end
|
||||
|
||||
def other_names_changed(type)
|
||||
other = self.send(type)
|
||||
other = send(type)
|
||||
((other_names - other.other_names) | (other.other_names - other_names)).length.positive?
|
||||
end
|
||||
|
||||
def urls_changed(type)
|
||||
other = self.send(type)
|
||||
other = send(type)
|
||||
((urls - other.urls) | (other.urls - urls)).length.positive?
|
||||
end
|
||||
|
||||
def was_deleted(type)
|
||||
other = self.send(type)
|
||||
other = send(type)
|
||||
if type == "previous"
|
||||
is_deleted && !other.is_deleted
|
||||
else
|
||||
@@ -85,7 +81,7 @@ class ArtistVersion < ApplicationRecord
|
||||
end
|
||||
|
||||
def was_undeleted(type)
|
||||
other = self.send(type)
|
||||
other = send(type)
|
||||
if type == "previous"
|
||||
!is_deleted && other.is_deleted
|
||||
else
|
||||
@@ -94,7 +90,7 @@ class ArtistVersion < ApplicationRecord
|
||||
end
|
||||
|
||||
def was_banned(type)
|
||||
other = self.send(type)
|
||||
other = send(type)
|
||||
if type == "previous"
|
||||
is_banned && !other.is_banned
|
||||
else
|
||||
@@ -103,7 +99,7 @@ class ArtistVersion < ApplicationRecord
|
||||
end
|
||||
|
||||
def was_unbanned(type)
|
||||
other = self.send(type)
|
||||
other = send(type)
|
||||
if type == "previous"
|
||||
!is_banned && other.is_banned
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user