Increase history pageSize from 100 to 500 to fetch more records
Fixes issue where series beyond position 100 in history were not appearing in recently completed section.
This commit is contained in:
@@ -251,8 +251,6 @@ router.get('/recent', requireAuth, async (req, res) => {
|
||||
showAll ? getEmbyUsers() : Promise.resolve(new Map())
|
||||
]);
|
||||
|
||||
console.log(`[History] Fetched ${sonarrHistory.length} Sonarr records, ${radarrHistory.length} Radarr records since ${since.toISOString()}`);
|
||||
|
||||
// Build tag maps from the cached poll data where available,
|
||||
// falling back to what's embedded in history records
|
||||
const sonarrTagsData = cache.get('poll:sonarr-tags') || [];
|
||||
@@ -260,37 +258,22 @@ router.get('/recent', requireAuth, async (req, res) => {
|
||||
const sonarrTagMap = new Map(sonarrTagsData.flatMap(t => t.data || []).map(t => [t.id, t.label]));
|
||||
const radarrTagMap = new Map(radarrTagsData.map(t => [t.id, t.label]));
|
||||
|
||||
console.log(`[History] Tag maps - sonarr: ${sonarrTagMap.size} tags, radarr: ${radarrTagMap.size} tags`);
|
||||
|
||||
const historyItems = [];
|
||||
|
||||
// --- Sonarr history ---
|
||||
for (const record of sonarrHistory) {
|
||||
try {
|
||||
const outcome = classifySonarrEvent(record.eventType);
|
||||
if (outcome === 'other') {
|
||||
console.log(`[History] Filtered out Sonarr record with eventType: ${record.eventType}, sourceTitle: ${record.sourceTitle || record.title || 'unknown'}`);
|
||||
continue;
|
||||
}
|
||||
if (outcome === 'other') continue;
|
||||
|
||||
const series = record.series;
|
||||
if (!series) {
|
||||
console.log(`[History] Filtered out Sonarr record with no series object - eventType: ${record.eventType}, sourceTitle: ${record.sourceTitle || record.title || 'unknown'}`);
|
||||
continue;
|
||||
}
|
||||
if (!series) continue;
|
||||
|
||||
const rawTagIds = series.tags || [];
|
||||
const allTags = extractAllTags(series.tags, sonarrTagMap);
|
||||
const matchedUserTag = extractUserTag(series.tags, sonarrTagMap, username);
|
||||
const hasAnyTag = allTags.length > 0;
|
||||
|
||||
// Log all series to see what's coming through
|
||||
console.log(`[History] Series: "${series.title}" - raw tag IDs: [${rawTagIds.join(', ') || 'none'}], resolved tags: [${allTags.join(', ') || 'none'}], matchedUserTag: ${matchedUserTag || 'none'}`);
|
||||
|
||||
if (!(showAll ? hasAnyTag : !!matchedUserTag)) {
|
||||
console.log(`[History] Filtered out series "${series.title}" - tags: [${allTags.join(', ') || 'none'}], matchedUserTag: ${matchedUserTag || 'none'}, username: ${username}, showAll: ${showAll}`);
|
||||
continue;
|
||||
}
|
||||
if (!(showAll ? hasAnyTag : !!matchedUserTag)) continue;
|
||||
|
||||
const quality = record.quality && record.quality.quality && record.quality.quality.name
|
||||
? record.quality.quality.name
|
||||
@@ -331,28 +314,16 @@ router.get('/recent', requireAuth, async (req, res) => {
|
||||
for (const record of radarrHistory) {
|
||||
try {
|
||||
const outcome = classifyRadarrEvent(record.eventType);
|
||||
if (outcome === 'other') {
|
||||
console.log(`[History] Filtered out Radarr record with eventType: ${record.eventType}, sourceTitle: ${record.sourceTitle || record.title || 'unknown'}`);
|
||||
continue;
|
||||
}
|
||||
if (outcome === 'other') continue;
|
||||
|
||||
const movie = record.movie;
|
||||
if (!movie) {
|
||||
console.log(`[History] Filtered out Radarr record with no movie object - eventType: ${record.eventType}, sourceTitle: ${record.sourceTitle || record.title || 'unknown'}`);
|
||||
continue;
|
||||
}
|
||||
const rawTagIds = movie.tags || [];
|
||||
if (!movie) continue;
|
||||
|
||||
const allTags = extractAllTags(movie.tags, radarrTagMap);
|
||||
const matchedUserTag = extractUserTag(movie.tags, radarrTagMap, username);
|
||||
const hasAnyTag = allTags.length > 0;
|
||||
|
||||
// Log all movies to see what's coming through
|
||||
console.log(`[History] Movie: "${movie.title}" - raw tag IDs: [${rawTagIds.join(', ') || 'none'}], resolved tags: [${allTags.join(', ') || 'none'}], matchedUserTag: ${matchedUserTag || 'none'}`);
|
||||
|
||||
if (!(showAll ? hasAnyTag : !!matchedUserTag)) {
|
||||
console.log(`[History] Filtered out movie "${movie.title}" - tags: [${allTags.join(', ') || 'none'}], matchedUserTag: ${matchedUserTag || 'none'}, username: ${username}, showAll: ${showAll}`);
|
||||
continue;
|
||||
}
|
||||
if (!(showAll ? hasAnyTag : !!matchedUserTag)) continue;
|
||||
|
||||
const quality = record.quality && record.quality.quality && record.quality.quality.name
|
||||
? record.quality.quality.name
|
||||
|
||||
@@ -38,7 +38,7 @@ async function fetchSonarrHistory(since) {
|
||||
|
||||
try {
|
||||
const response = await retriever.getHistory({
|
||||
pageSize: 100,
|
||||
pageSize: 500,
|
||||
sortKey: 'date',
|
||||
sortDir: 'descending',
|
||||
includeSeries: true,
|
||||
@@ -87,7 +87,7 @@ async function fetchRadarrHistory(since) {
|
||||
|
||||
try {
|
||||
const response = await retriever.getHistory({
|
||||
pageSize: 100,
|
||||
pageSize: 500,
|
||||
sortKey: 'date',
|
||||
sortDir: 'descending',
|
||||
includeMovie: true,
|
||||
|
||||
Reference in New Issue
Block a user