Fix incorrect wanted value in Radarr widget

fixes #397
pull/418/head
Jason Fischer 2 years ago
parent 23b16d765c
commit db1804b4a7
No known key found for this signature in database

@ -1,6 +1,18 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
import { jsonArrayFilter } from "utils/proxy/api-helpers";
function isAvailable(item) {
// isAvailable means that a digital image exists
// E.g. it's available to stream or on DVD, etc
if (item.isAvailable === false) {
return false;
}
// sizeOnDisk is how much of that digital image you currently have
// movieFile.size is how large the requested digital image is
return item.sizeOnDisk === item.movieFile?.size;
}
const widget = {
api: "{url}/api/v3/{endpoint}?apikey={key}",
proxyHandler: genericProxyHandler,
@ -9,8 +21,8 @@ const widget = {
movie: {
endpoint: "movie",
map: (data) => ({
wanted: jsonArrayFilter(data, (item) => item.isAvailable === false).length,
have: jsonArrayFilter(data, (item) => item.isAvailable === true).length,
wanted: jsonArrayFilter(data, (item) => !isAvailable(item)).length,
have: jsonArrayFilter(data, (item) => isAvailable(item)).length,
}),
},
"queue/status": {

Loading…
Cancel
Save