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

View File

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

View File

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