New: Show updated Custom Format Score in history

(cherry picked from commit 6dcfc661a12f4c6f03345235fb5531c866666a6a)

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

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

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

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

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

Loading…
Cancel
Save