Bug Fix: Fixed VOD logo cleanup button count: The "Cleanup Unused" button now displays the total count of all unused logos across all pages instead of only counting unused logos on the current page.
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Frontend Tests / test (push) Waiting to run

This commit is contained in:
SergeantPanda 2026-01-16 14:03:48 -06:00
parent d80da75795
commit 19d25f37c6
3 changed files with 39 additions and 7 deletions

View file

@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed VOD logo cleanup button count: The "Cleanup Unused" button now displays the total count of all unused logos across all pages instead of only counting unused logos on the current page.
- Fixed VOD refresh failures when logos are deleted: Changed logo comparisons to use `logo_id` (raw FK integer) instead of `logo` (related object) to avoid Django's lazy loading, which triggers a database fetch that fails if the referenced logo no longer exists. Also improved orphaned logo detection to properly clear stale references when logo URLs exist but logos are missing from the database.
- Fixed channel profile filtering to properly restrict content based on assigned channel profiles for all non-admin users (user_level < 10) instead of only streamers (user_level == 0). This corrects the XtreamCodes API endpoints (`get_live_categories` and `get_live_streams`) along with M3U and EPG generation, ensuring standard users (level 1) are properly restricted by their assigned channel profiles. Previously, "Standard" users with channel profiles assigned would see all channels instead of only those in their assigned profiles.
- Fixed NumPy baseline detection in Docker entrypoint. Now calls `numpy.show_config()` directly with case-insensitive grep instead of incorrectly wrapping the output.

View file

@ -64,6 +64,7 @@ export default function VODLogosTable() {
deleteVODLogo,
deleteVODLogos,
cleanupUnusedVODLogos,
getUnusedLogosCount,
} = useVODLogosStore();
const [currentPage, setCurrentPage] = useState(1);
@ -77,14 +78,9 @@ export default function VODLogosTable() {
const [deleting, setDeleting] = useState(false);
const [paginationString, setPaginationString] = useState('');
const [isCleaningUp, setIsCleaningUp] = useState(false);
const [unusedLogosCount, setUnusedLogosCount] = useState(0);
const [loadingUnusedCount, setLoadingUnusedCount] = useState(false);
const tableRef = React.useRef(null);
// Calculate unused logos count
const unusedLogosCount = useMemo(() => {
return logos.filter(
(logo) => logo.movie_count === 0 && logo.series_count === 0
).length;
}, [logos]);
useEffect(() => {
fetchVODLogos({
page: currentPage,
@ -94,6 +90,23 @@ export default function VODLogosTable() {
});
}, [currentPage, pageSize, nameFilter, usageFilter, fetchVODLogos]);
// Fetch the total count of unused logos
useEffect(() => {
const fetchUnusedCount = async () => {
setLoadingUnusedCount(true);
try {
const count = await getUnusedLogosCount();
setUnusedLogosCount(count);
} catch (error) {
console.error('Failed to fetch unused logos count:', error);
} finally {
setLoadingUnusedCount(false);
}
};
fetchUnusedCount();
}, [getUnusedLogosCount]);
const handleSelectAll = useCallback(
(checked) => {
if (checked) {
@ -185,6 +198,9 @@ export default function VODLogosTable() {
message: `Cleaned up ${result.deleted_count} unused VOD logos`,
color: 'green',
});
// Refresh the unused count after cleanup
const newCount = await getUnusedLogosCount();
setUnusedLogosCount(newCount);
} catch (error) {
notifications.show({
title: 'Error',

View file

@ -116,6 +116,21 @@ const useVODLogosStore = create((set) => ({
}
},
getUnusedLogosCount: async () => {
try {
const response = await api.getVODLogos({
used: 'false',
page_size: 1, // Fetch only 1 item to minimize data transfer
});
// Return the count from the paginated response
return response.count || 0;
} catch (error) {
console.error('Failed to fetch unused logos count:', error);
throw error;
}
},
clearVODLogos: () => {
set({
vodLogos: {},