Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TNO-3016 Fix exclude content filters #2236

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libs/net/dal/Services/ReportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ public IEnumerable<ReportInstance> GetLatestInstances(int id, int? ownerId = nul
if (sectionSettings.RemoveDuplicates)
query = query.Where(fc => !excludeAboveSectionContentIds.Contains(fc.ContentId));

if (excludeContentIds.Any() && !sectionSettings.OverrideExcludeHistorical)
if (excludeContentIds.Any())
query = query.Where(fc => !excludeContentIds.Contains(fc.ContentId));

var content = query
Expand All @@ -851,9 +851,9 @@ public IEnumerable<ReportInstance> GetLatestInstances(int id, int? ownerId = nul

// Modify the query to exclude content.
var excludeOnlyTheseContentIds = excludeContentIds.Any() && !sectionSettings.OverrideExcludeHistorical ? excludeContentIds : Array.Empty<long>();
var excludeAboveAndHistorical = sectionSettings.RemoveDuplicates
var excludeAboveAndHistorical = sectionSettings.OverrideExcludeHistorical
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a user selects the "Include all content from linked folder even if in prior report" in a section does this work? This is where the overrideExcludeHistorical setting comes from. It's a per-section configuration option. It ensures that that specific section will still include content that was also in a linked report. The reason for this is because Scott wants the folder content to show up no matter what.

image

Copy link
Collaborator Author

@fbarreta fbarreta Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would, because the variable excludeOnlyTheseContentIds on line 853 is assigned like that:
var excludeOnlyTheseContentIds = excludeContentIds.Any() && !sectionSettings.OverrideExcludeHistorical ? excludeContentIds : Array.Empty();
It would only be populated if the Override is NOT checked.
In this case its checked, excludeOnlyTheseContentIds is empty and would not exclude those contents.

? excludeOnlyTheseContentIds.AppendRange(excludeAboveSectionContentIds).Distinct().ToArray()
: Array.Empty<long>();
: excludeOnlyTheseContentIds;
var query = excludeAboveAndHistorical.Any()
? section.Filter.Query.AddExcludeContent(excludeAboveAndHistorical)
: section.Filter.Query;
Expand Down
Loading