New: Show updated Custom Format Score in history

(cherry picked from commit 6dcfc661a12f4c6f03345235fb5531c866666a6a)

Closes #3291
pull/3876/head
Mark McDowall 2 years ago committed by Bogdan
parent 8c9d3d09fa
commit e8d3e55b9c

@ -58,6 +58,7 @@ class HistoryRow extends Component {
track, track,
quality, quality,
customFormats, customFormats,
customFormatScore,
qualityCutoffNotMet, qualityCutoffNotMet,
eventType, eventType,
sourceTitle, sourceTitle,
@ -186,7 +187,7 @@ class HistoryRow extends Component {
key={name} key={name}
className={styles.customFormatScore} className={styles.customFormatScore}
> >
{formatPreferredWordScore(data.customFormatScore)} {formatPreferredWordScore(customFormatScore)}
</TableRowCell> </TableRowCell>
); );
} }
@ -254,6 +255,7 @@ HistoryRow.propTypes = {
track: PropTypes.object, track: PropTypes.object,
quality: PropTypes.object.isRequired, quality: PropTypes.object.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object), customFormats: PropTypes.arrayOf(PropTypes.object),
customFormatScore: PropTypes.number.isRequired,
qualityCutoffNotMet: PropTypes.bool.isRequired, qualityCutoffNotMet: PropTypes.bool.isRequired,
eventType: PropTypes.string.isRequired, eventType: PropTypes.string.isRequired,
sourceTitle: PropTypes.string.isRequired, sourceTitle: PropTypes.string.isRequired,

@ -1,6 +1,7 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import Alert from 'Components/Alert'; import Alert from 'Components/Alert';
import Icon from 'Components/Icon';
import Button from 'Components/Link/Button'; import Button from 'Components/Link/Button';
import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import ModalBody from 'Components/Modal/ModalBody'; import ModalBody from 'Components/Modal/ModalBody';
@ -9,7 +10,7 @@ import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader'; import ModalHeader from 'Components/Modal/ModalHeader';
import Table from 'Components/Table/Table'; import Table from 'Components/Table/Table';
import TableBody from 'Components/Table/TableBody'; import TableBody from 'Components/Table/TableBody';
import { kinds } from 'Helpers/Props'; import { icons, kinds } from 'Helpers/Props';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import ArtistHistoryRowConnector from './ArtistHistoryRowConnector'; import ArtistHistoryRowConnector from './ArtistHistoryRowConnector';
@ -43,6 +44,15 @@ const columns = [
label: translate('Details'), label: translate('Details'),
isVisible: true isVisible: true
}, },
{
name: 'customFormatScore',
label: React.createElement(Icon, {
name: icons.SCORE,
title: 'Custom format score'
}),
isSortable: true,
isVisible: true
},
{ {
name: 'actions', name: 'actions',
label: translate('Actions'), label: translate('Actions'),

@ -11,6 +11,7 @@ import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRow from 'Components/Table/TableRow'; import TableRow from 'Components/Table/TableRow';
import Popover from 'Components/Tooltip/Popover'; import Popover from 'Components/Tooltip/Popover';
import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import styles from './ArtistHistoryRow.css'; import styles from './ArtistHistoryRow.css';
@ -75,6 +76,7 @@ class ArtistHistoryRow extends Component {
sourceTitle, sourceTitle,
quality, quality,
qualityCutoffNotMet, qualityCutoffNotMet,
customFormatScore,
date, date,
data, data,
album album
@ -129,6 +131,10 @@ class ArtistHistoryRow extends Component {
/> />
</TableRowCell> </TableRowCell>
<TableRowCell className={styles.customFormatScore}>
{formatPreferredWordScore(customFormatScore)}
</TableRowCell>
<TableRowCell className={styles.actions}> <TableRowCell className={styles.actions}>
{ {
eventType === 'grabbed' && eventType === 'grabbed' &&
@ -160,6 +166,7 @@ ArtistHistoryRow.propTypes = {
sourceTitle: PropTypes.string.isRequired, sourceTitle: PropTypes.string.isRequired,
quality: PropTypes.object.isRequired, quality: PropTypes.object.isRequired,
qualityCutoffNotMet: PropTypes.bool.isRequired, qualityCutoffNotMet: PropTypes.bool.isRequired,
customFormatScore: PropTypes.number.isRequired,
date: PropTypes.string.isRequired, date: PropTypes.string.isRequired,
data: PropTypes.object.isRequired, data: PropTypes.object.isRequired,
fullArtist: PropTypes.bool.isRequired, fullArtist: PropTypes.bool.isRequired,

@ -19,6 +19,7 @@ namespace Lidarr.Api.V1.History
public string SourceTitle { get; set; } public string SourceTitle { get; set; }
public QualityModel Quality { get; set; } public QualityModel Quality { get; set; }
public List<CustomFormatResource> CustomFormats { get; set; } public List<CustomFormatResource> CustomFormats { get; set; }
public int CustomFormatScore { get; set; }
public bool QualityCutoffNotMet { get; set; } public bool QualityCutoffNotMet { get; set; }
public DateTime Date { get; set; } public DateTime Date { get; set; }
public string DownloadId { get; set; } public string DownloadId { get; set; }
@ -41,6 +42,9 @@ namespace Lidarr.Api.V1.History
return null; return null;
} }
var customFormats = formatCalculator.ParseCustomFormat(model, model.Artist);
var customFormatScore = model.Artist?.QualityProfile?.Value?.CalculateCustomFormatScore(customFormats) ?? 0;
return new HistoryResource return new HistoryResource
{ {
Id = model.Id, Id = model.Id,
@ -50,7 +54,8 @@ namespace Lidarr.Api.V1.History
TrackId = model.TrackId, TrackId = model.TrackId,
SourceTitle = model.SourceTitle, SourceTitle = model.SourceTitle,
Quality = model.Quality, Quality = model.Quality,
CustomFormats = formatCalculator.ParseCustomFormat(model, model.Artist).ToResource(false), CustomFormats = customFormats.ToResource(false),
CustomFormatScore = customFormatScore,
// QualityCutoffNotMet // QualityCutoffNotMet
Date = model.Date, Date = model.Date,

Loading…
Cancel
Save