Sort guide by channel number.

This commit is contained in:
SergeantPanda 2025-04-08 10:12:27 -05:00
parent 0ff84457de
commit d72a08c9de

View file

@ -64,9 +64,11 @@ export default function TVChannelGuide({ startDate, endDate }) {
const programIds = [...new Set(fetched.map((p) => p.tvg_id))];
// Filter your Redux/Zustand channels by matching tvg_id
const filteredChannels = Object.values(channels).filter((ch) =>
programIds.includes(ch.epg_data?.tvg_id)
);
const filteredChannels = Object.values(channels)
.filter((ch) => programIds.includes(ch.epg_data?.tvg_id))
// Add sorting by channel_number
.sort((a, b) => (a.channel_number || Infinity) - (b.channel_number || Infinity));
console.log(
`found ${filteredChannels.length} channels with matching tvg_ids`
);