Fixed: Sort authors by lastname, firstname

This commit is contained in:
ta264
2021-05-13 21:31:46 +01:00
parent 62221c2a7f
commit 96db74494a
26 changed files with 279 additions and 27 deletions
@@ -78,7 +78,7 @@ class BlacklistRow extends Component {
return null;
}
if (name === 'authors.sortName') {
if (name === 'authorMetadata.sortName') {
return (
<TableRowCell key={name}>
<AuthorNameLink
+1 -1
View File
@@ -93,7 +93,7 @@ class HistoryRow extends Component {
);
}
if (name === 'authors.sortName') {
if (name === 'authorMetadata.sortName') {
return (
<TableRowCell key={name}>
<AuthorNameLink
+1 -1
View File
@@ -138,7 +138,7 @@ class QueueRow extends Component {
);
}
if (name === 'authors.sortName') {
if (name === 'authorMetadata.sortName') {
return (
<TableRowCell key={name}>
{
@@ -31,7 +31,7 @@ export const defaultState = {
columns: [
{
name: 'authors.sortName',
name: 'authorMetadata.sortName',
label: 'Author Name',
isSortable: true,
isVisible: true
+1 -1
View File
@@ -34,7 +34,7 @@ export const defaultState = {
isModifiable: false
},
{
name: 'authors.sortName',
name: 'authorMetadata.sortName',
label: 'Author',
isSortable: true,
isVisible: true
+1 -1
View File
@@ -63,7 +63,7 @@ export const defaultState = {
isModifiable: false
},
{
name: 'authors.sortName',
name: 'authorMetadata.sortName',
label: 'Author',
isSortable: true,
isVisible: true
+2 -2
View File
@@ -28,7 +28,7 @@ export const defaultState = {
columns: [
{
name: 'authors.sortName',
name: 'authorMetadata.sortName',
label: 'Author',
isSortable: true,
isVisible: true
@@ -91,7 +91,7 @@ export const defaultState = {
columns: [
{
name: 'authors.sortName',
name: 'authorMetadata.sortName',
label: 'Author',
isSortable: true,
isVisible: true
+2
View File
@@ -1,5 +1,7 @@
import migrateAddAuthorDefaults from './migrateAddAuthorDefaults';
import migrateAuthorSortKey from './migrateAuthorSortKey';
export default function migrate(persistedState) {
migrateAddAuthorDefaults(persistedState);
migrateAuthorSortKey(persistedState);
}
@@ -0,0 +1,15 @@
import { get, set } from 'lodash';
const TABLES_TO_MIGRATE = ['blacklist', 'history', 'queue.paged', 'wanted.missing', 'wanted.cutoffUnmet'];
export default function migrateAuthorSortKey(persistedState) {
for (const table of TABLES_TO_MIGRATE) {
const key = `${table}.sortKey`;
const sortKey = get(persistedState, key);
if (sortKey === 'authors.sortName') {
set(persistedState, key, 'authorMetadata.sortName');
}
}
}
@@ -48,7 +48,7 @@ function CutoffUnmetRow(props) {
return null;
}
if (name === 'authors.sortName') {
if (name === 'authorMetadata.sortName') {
return (
<TableRowCell key={name}>
<AuthorNameLink
+1 -1
View File
@@ -45,7 +45,7 @@ function MissingRow(props) {
return null;
}
if (name === 'authors.sortName') {
if (name === 'authorMetadata.sortName') {
return (
<TableRowCell key={name}>
<AuthorNameLink