mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
New: Custom Formats
Co-Authored-By: ta264 <ta264@users.noreply.github.com>
This commit is contained in:
16
frontend/src/Utilities/Number/formatPreferredWordScore.js
Normal file
16
frontend/src/Utilities/Number/formatPreferredWordScore.js
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
function formatPreferredWordScore(input, customFormatsLength = 0) {
|
||||
const score = Number(input);
|
||||
|
||||
if (score > 0) {
|
||||
return `+${score}`;
|
||||
}
|
||||
|
||||
if (score < 0) {
|
||||
return score;
|
||||
}
|
||||
|
||||
return customFormatsLength > 0 ? '+0' : '';
|
||||
}
|
||||
|
||||
export default formatPreferredWordScore;
|
||||
5
frontend/src/Utilities/State/getNextId.js
Normal file
5
frontend/src/Utilities/State/getNextId.js
Normal file
@@ -0,0 +1,5 @@
|
||||
function getNextId(items) {
|
||||
return items.reduce((id, x) => Math.max(id, x.id), 1) + 1;
|
||||
}
|
||||
|
||||
export default getNextId;
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ from 'lodash';
|
||||
import getSectionState from 'Utilities/State/getSectionState';
|
||||
|
||||
function getProviderState(payload, getState, section) {
|
||||
function getProviderState(payload, getState, section, keyValueOnly=true) {
|
||||
const {
|
||||
id,
|
||||
...otherPayload
|
||||
@@ -23,10 +23,17 @@ function getProviderState(payload, getState, section) {
|
||||
field.value;
|
||||
|
||||
// Only send the name and value to the server
|
||||
result.push({
|
||||
name,
|
||||
value
|
||||
});
|
||||
if (keyValueOnly) {
|
||||
result.push({
|
||||
name,
|
||||
value
|
||||
});
|
||||
} else {
|
||||
result.push({
|
||||
...field,
|
||||
value
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user