New: Show updated Custom Format Score in history

This commit is contained in:
Mark McDowall 2022-12-12 23:48:48 -08:00 committed by Mark McDowall
parent 68d026479f
commit 6dcfc661a1
3 changed files with 12 additions and 3 deletions

View File

@ -62,6 +62,7 @@ class HistoryRow extends Component {
languages,
quality,
customFormats,
customFormatScore,
qualityCutoffNotMet,
eventType,
sourceTitle,
@ -209,7 +210,7 @@ class HistoryRow extends Component {
key={name}
className={styles.customFormatScore}
>
{formatPreferredWordScore(data.customFormatScore)}
{formatPreferredWordScore(customFormatScore)}
</TableRowCell>
);
}
@ -277,6 +278,7 @@ HistoryRow.propTypes = {
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
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,

View File

@ -69,6 +69,7 @@ class EpisodeHistoryRow extends Component {
quality,
qualityCutoffNotMet,
customFormats,
customFormatScore,
date,
data
} = this.props;
@ -125,7 +126,7 @@ class EpisodeHistoryRow extends Component {
<TableRowCell className={styles.customFormatScore}>
<Tooltip
anchor={
formatPreferredWordScore(data.customFormatScore, customFormats.length)
formatPreferredWordScore(customFormatScore, customFormats.length)
}
tooltip={<EpisodeFormats formats={customFormats} />}
position={tooltipPositions.BOTTOM}
@ -165,6 +166,7 @@ EpisodeHistoryRow.propTypes = {
quality: PropTypes.object.isRequired,
qualityCutoffNotMet: PropTypes.bool.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object),
customFormatScore: PropTypes.number.isRequired,
date: PropTypes.string.isRequired,
data: PropTypes.object.isRequired,
onMarkAsFailedPress: PropTypes.func.isRequired

View File

@ -19,6 +19,7 @@ namespace Sonarr.Api.V3.History
public List<Language> Languages { 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; }
@ -40,6 +41,9 @@ namespace Sonarr.Api.V3.History
return null;
}
var customFormats = formatCalculator.ParseCustomFormat(model, model.Series);
var customFormatScore = model.Series.QualityProfile.Value.CalculateCustomFormatScore(customFormats);
return new HistoryResource
{
Id = model.Id,
@ -49,7 +53,8 @@ namespace Sonarr.Api.V3.History
SourceTitle = model.SourceTitle,
Languages = model.Languages,
Quality = model.Quality,
CustomFormats = formatCalculator.ParseCustomFormat(model, model.Series).ToResource(false),
CustomFormats = customFormats.ToResource(false),
CustomFormatScore = customFormatScore,
// QualityCutoffNotMet
Date = model.Date,