mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
update DiscontinuedDate during snaps, temp disable seeding of DiscontinuedDate
closes #427 opens #544
This commit is contained in:
parent
a41b547177
commit
0acdfc4539
2 changed files with 10 additions and 1 deletions
|
|
@ -102,7 +102,8 @@ private static async Task InsertOnDuplicateKeyUpdate<TEntity>(DbContext dbContex
|
|||
|
||||
private static List<IProperty> GetPropertiesLessValueGeneratedTimestamps(IEntityType entityType) =>
|
||||
entityType.GetProperties()
|
||||
.Where(x => !new List<string> {"CreatedDateUtc", "ModifiedDateUtc"}.Contains(x.Name))
|
||||
.Where(x =>
|
||||
!new List<string> {"CreatedDateUtc", "ModifiedDateUtc", "DiscontinuedDate"}.Contains(x.Name))
|
||||
.ToList();
|
||||
|
||||
private static string CreateValues<TEntity>(IEnumerable<TEntity> seed,
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ private async Task GetLinesFromSource(HttpResponseMessage response)
|
|||
await SetWasUpdated();
|
||||
if (SnapEntity.WasUpdated)
|
||||
{
|
||||
await UpdateDiscontinuedDate();
|
||||
memoryStream.Position = 0;
|
||||
if (ListUrl.EndsWith(".7z"))
|
||||
await GetLinesFrom7Zip(memoryStream);
|
||||
|
|
@ -152,6 +153,13 @@ await dbContext.Snapshots
|
|||
.Select(s => s.Md5Checksum)
|
||||
.FirstOrDefaultAsync() ?? Array.Empty<byte>();
|
||||
|
||||
private async Task UpdateDiscontinuedDate()
|
||||
{
|
||||
var list = await dbContext.FilterLists.FirstOrDefaultAsync(l => l.Id == List.Id);
|
||||
if (!(list.DiscontinuedDate is null) && DateTime.Now > list.DiscontinuedDate)
|
||||
list.DiscontinuedDate = null;
|
||||
}
|
||||
|
||||
private async Task GetLinesFrom7Zip(Stream stream)
|
||||
{
|
||||
using (var archive = SevenZipArchive.Open(stream))
|
||||
|
|
|
|||
Loading…
Reference in a new issue