Rework artist versions index view

- Added a changes column explicitly listing all of the changes
-- This makes it more in line with the other version views now
- Does a symmetric difference on the array fields to detect changes
This commit is contained in:
BrokenEagle
2020-02-08 08:25:36 +00:00
parent de1324098d
commit 7b1efd1204
3 changed files with 46 additions and 15 deletions

View File

@@ -29,4 +29,41 @@ class ArtistVersion < ApplicationRecord
end
@previous.first
end
def self.status_fields
{
name: "Renamed",
urls_changed: "URLs",
other_names_changed: "OtherNames",
group_name: "GroupName",
was_deleted: "Deleted",
was_undeleted: "Undeleted",
was_banned: "Banned",
was_unbanned: "Unbanned",
}
end
def other_names_changed
((other_names - previous.other_names) | (previous.other_names - other_names)).length > 0
end
def urls_changed
((urls - previous.urls) | (previous.urls - urls)).length > 0
end
def was_deleted
!is_active && previous.is_active
end
def was_undeleted
is_active && !previous.is_active
end
def was_banned
is_banned && !previous.is_banned
end
def was_unbanned
!is_banned && previous.is_banned
end
end