Skip to content

Commit

Permalink
static topic id removed
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-zhur committed Sep 28, 2024
1 parent 9279293 commit ff2cdb1
Show file tree
Hide file tree
Showing 6 changed files with 954 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ public async Task SaveMessages()
var albums = await _videosDatabase.Albums
.Where(x => x.UploadedAlbum == null)
.Include(x => x.Constraints)
.ThenInclude(x => x.Topic)
.ToListAsync();

var messages = (await _videosDatabase.Mediae
.Where(x => x.StaticMessage != null)
.Where(x => x.StaticMessage!.SelectedType.HasValue && x.StaticMessage.StaticTopic != null)
.Where(x => x.StaticMessage!.SelectedType.HasValue && x.StaticMessage.StaticTopic!.Topic != null)
.Select(m => new
{
StaticTopicId = m.StaticMessage!.StaticTopic!.Id,
TopicId = m.StaticMessage!.StaticTopic!.Topic!.Id,
m.StaticMessage.StaticTopicRootMessageIdOr0,
m.StaticMessage.Width,
m.StaticMessage.Height,
Expand All @@ -121,7 +122,7 @@ public async Task SaveMessages()
m.Id,
})
.ToListAsync())
.ToLookup(x => x.StaticTopicId);
.ToLookup(x => x.TopicId);

var uploadedItems = await _videosDatabase.UploadedItems
.Where(i => _videosDatabase.InventoryItems.Any(j => j.Id == i.MediaItemId && (j.IsPhoto || j.MediaMetadataVideoStatus == "READY")))
Expand All @@ -130,7 +131,7 @@ public async Task SaveMessages()
return albums
.Select(a => (a.Id, a.Title,
a.Constraints
.SelectMany(c => messages[c.StaticTopicId!.Value].Where(m =>
.SelectMany(c => messages[c.TopicId!.Value].Where(m =>
{
if (c.StaticMessageSelectedType.HasValue && c.StaticMessageSelectedType != m.SelectedType) return false;
if (c.IsSquare && m.Width != m.Height) return false;
Expand Down
Loading

0 comments on commit ff2cdb1

Please sign in to comment.