mirror of
https://github.com/Readarr/Readarr
synced 2026-01-07 16:13:05 +01:00
Rename formatPreferredWordScore to formatCustomFormatScore
Closes #2731
This commit is contained in:
parent
d73eb1b5f9
commit
d3443510b4
5 changed files with 16 additions and 14 deletions
|
|
@ -9,7 +9,7 @@ import Link from 'Components/Link/Link';
|
|||
import { icons } from 'Helpers/Props';
|
||||
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||
import formatAge from 'Utilities/Number/formatAge';
|
||||
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './HistoryDetails.css';
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ function HistoryDetails(props) {
|
|||
customFormatScore && customFormatScore !== '0' ?
|
||||
<DescriptionListItem
|
||||
title={translate('CustomFormatScore')}
|
||||
data={formatPreferredWordScore(customFormatScore)}
|
||||
data={formatCustomFormatScore(customFormatScore)}
|
||||
/> :
|
||||
null
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ function HistoryDetails(props) {
|
|||
customFormatScore && customFormatScore !== '0' ?
|
||||
<DescriptionListItem
|
||||
title={translate('CustomFormatScore')}
|
||||
data={formatPreferredWordScore(customFormatScore)}
|
||||
data={formatCustomFormatScore(customFormatScore)}
|
||||
/> :
|
||||
null
|
||||
}
|
||||
|
|
@ -271,7 +271,7 @@ function HistoryDetails(props) {
|
|||
customFormatScore && customFormatScore !== '0' ?
|
||||
<DescriptionListItem
|
||||
title={translate('CustomFormatScore')}
|
||||
data={formatPreferredWordScore(customFormatScore)}
|
||||
data={formatCustomFormatScore(customFormatScore)}
|
||||
/> :
|
||||
null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
|||
import TableRow from 'Components/Table/TableRow';
|
||||
import Tooltip from 'Components/Tooltip/Tooltip';
|
||||
import { icons, tooltipPositions } from 'Helpers/Props';
|
||||
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||
import HistoryDetailsModal from './Details/HistoryDetailsModal';
|
||||
import HistoryEventTypeCell from './HistoryEventTypeCell';
|
||||
import styles from './HistoryRow.css';
|
||||
|
|
@ -180,7 +180,7 @@ class HistoryRow extends Component {
|
|||
className={styles.customFormatScore}
|
||||
>
|
||||
<Tooltip
|
||||
anchor={formatPreferredWordScore(
|
||||
anchor={formatCustomFormatScore(
|
||||
customFormatScore,
|
||||
customFormats.length
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import Tooltip from 'Components/Tooltip/Tooltip';
|
|||
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
|
||||
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
||||
import formatBytes from 'Utilities/Number/formatBytes';
|
||||
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import QueueStatusCell from './QueueStatusCell';
|
||||
import RemoveQueueItemModal from './RemoveQueueItemModal';
|
||||
|
|
@ -232,7 +232,7 @@ class QueueRow extends Component {
|
|||
className={styles.customFormatScore}
|
||||
>
|
||||
<Tooltip
|
||||
anchor={formatPreferredWordScore(
|
||||
anchor={formatCustomFormatScore(
|
||||
customFormatScore,
|
||||
customFormats.length
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { icons, kinds, tooltipPositions } from 'Helpers/Props';
|
|||
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||
import formatAge from 'Utilities/Number/formatAge';
|
||||
import formatBytes from 'Utilities/Number/formatBytes';
|
||||
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
|
||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import Peers from './Peers';
|
||||
import styles from './InteractiveSearchRow.css';
|
||||
|
|
@ -172,7 +172,7 @@ class InteractiveSearchRow extends Component {
|
|||
<TableRowCell className={styles.customFormatScore}>
|
||||
<Tooltip
|
||||
anchor={
|
||||
formatPreferredWordScore(customFormatScore, customFormats.length)
|
||||
formatCustomFormatScore(customFormatScore, customFormats.length)
|
||||
}
|
||||
tooltip={<BookFormats formats={customFormats} />}
|
||||
position={tooltipPositions.BOTTOM}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
function formatPreferredWordScore(input, customFormatsLength = 0) {
|
||||
function formatCustomFormatScore(
|
||||
input?: number,
|
||||
customFormatsLength = 0
|
||||
): string {
|
||||
const score = Number(input);
|
||||
|
||||
if (score > 0) {
|
||||
|
|
@ -7,10 +9,10 @@ function formatPreferredWordScore(input, customFormatsLength = 0) {
|
|||
}
|
||||
|
||||
if (score < 0) {
|
||||
return score;
|
||||
return `${score}`;
|
||||
}
|
||||
|
||||
return customFormatsLength > 0 ? '+0' : '';
|
||||
}
|
||||
|
||||
export default formatPreferredWordScore;
|
||||
export default formatCustomFormatScore;
|
||||
Loading…
Reference in a new issue