Scrobbling Polish and Some Scanner fixes (#3638)

Co-authored-by: Fesaa <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
Joe Milazzo 2025-03-15 11:13:01 -05:00 committed by GitHub
parent 82e8f7fade
commit f281a63934
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 658 additions and 102 deletions

View file

@ -32,6 +32,8 @@ public interface IScrobbleRepository
Task<IEnumerable<ScrobbleEvent>> GetUserEventsForSeries(int userId, int seriesId);
Task<PagedList<ScrobbleEventDto>> GetUserEvents(int userId, ScrobbleEventFilter filter, UserParams pagination);
Task<IList<ScrobbleEvent>> GetAllEventsForSeries(int seriesId);
Task<IList<ScrobbleEvent>> GetAllEventsWithSeriesIds(IEnumerable<int> seriesIds);
Task<IList<ScrobbleEvent>> GetEvents();
}
/// <summary>
@ -97,6 +99,11 @@ public class ScrobbleRepository : IScrobbleRepository
.ToListAsync();
}
/// <summary>
/// Returns all processed events that were processed 7 or more days ago
/// </summary>
/// <param name="daysAgo"></param>
/// <returns></returns>
public async Task<IList<ScrobbleEvent>> GetProcessedEvents(int daysAgo)
{
var date = DateTime.UtcNow.Subtract(TimeSpan.FromDays(daysAgo));
@ -172,8 +179,22 @@ public class ScrobbleRepository : IScrobbleRepository
public async Task<IList<ScrobbleEvent>> GetAllEventsForSeries(int seriesId)
{
return await _context.ScrobbleEvent.Where(e => e.SeriesId == seriesId)
return await _context.ScrobbleEvent
.Where(e => e.SeriesId == seriesId)
.ToListAsync();
}
public async Task<IList<ScrobbleEvent>> GetAllEventsWithSeriesIds(IEnumerable<int> seriesIds)
{
return await _context.ScrobbleEvent
.Where(e => seriesIds.Contains(e.SeriesId))
.ToListAsync();
}
public async Task<IList<ScrobbleEvent>> GetEvents()
{
return await _context.ScrobbleEvent
.Include(e => e.AppUser)
.ToListAsync();
}
}