From ccb60ae367294aba14aa95a4438f2e2f6ce6bc6d Mon Sep 17 00:00:00 2001 From: Robert McRackan Date: Fri, 14 Feb 2020 14:01:36 -0500 Subject: [PATCH] Bugfix: IsAuthorNarrated was returning no books --- LibationLauncher/LibationLauncher.csproj | 2 +- LibationSearchEngine/UNTESTED/SearchEngine.cs | 14 ++++++++++++-- .../Dialogs/SearchSyntaxDialog.Designer.cs | 2 +- REFERENCE.txt | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj index 113cc8a8..8f49da54 100644 --- a/LibationLauncher/LibationLauncher.csproj +++ b/LibationLauncher/LibationLauncher.csproj @@ -13,7 +13,7 @@ win-x64 - 3.1.3.1 + 3.1.4.5 diff --git a/LibationSearchEngine/UNTESTED/SearchEngine.cs b/LibationSearchEngine/UNTESTED/SearchEngine.cs index e5d2c6ad..4346acb2 100644 --- a/LibationSearchEngine/UNTESTED/SearchEngine.cs +++ b/LibationSearchEngine/UNTESTED/SearchEngine.cs @@ -105,14 +105,24 @@ namespace LibationSearchEngine ["HasPDF"] = lb => lb.Book.Supplements.Any(), ["PDFs"] = lb => lb.Book.Supplements.Any(), ["PDF"] = lb => lb.Book.Supplements.Any(), + ["IsRated"] = lb => lb.Book.UserDefinedItem.Rating.OverallRating > 0f, ["Rated"] = lb => lb.Book.UserDefinedItem.Rating.OverallRating > 0f, - ["IsAuthorNarrated"] = lb => lb.Book.Authors.Intersect(lb.Book.Narrators).Any(), - ["AuthorNarrated"] = lb => lb.Book.Authors.Intersect(lb.Book.Narrators).Any(), + + ["IsAuthorNarrated"] = lb => isAuthorNarrated(lb), + ["AuthorNarrated"] = lb => isAuthorNarrated(lb), + [nameof(Book.IsAbridged)] = lb => lb.Book.IsAbridged, ["Abridged"] = lb => lb.Book.IsAbridged, }); + private static bool isAuthorNarrated(LibraryBook lb) + { + var authors = lb.Book.Authors.Select(a => a.Name).ToArray(); + var narrators = lb.Book.Narrators.Select(a => a.Name).ToArray(); + return authors.Intersect(narrators).Any(); + } + // use these common fields in the "all" default search field private static IEnumerable> allFieldIndexRules { get; } = new List> diff --git a/LibationWinForms/UNTESTED/Dialogs/SearchSyntaxDialog.Designer.cs b/LibationWinForms/UNTESTED/Dialogs/SearchSyntaxDialog.Designer.cs index be317279..7f07390f 100644 --- a/LibationWinForms/UNTESTED/Dialogs/SearchSyntaxDialog.Designer.cs +++ b/LibationWinForms/UNTESTED/Dialogs/SearchSyntaxDialog.Designer.cs @@ -73,7 +73,7 @@ this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(168, 52); this.label4.TabIndex = 3; - this.label4.Text = "BOOL FIELDS\r\n\r\nFind books that you haven\'t rated:\r\n -IsRated"; + this.label4.Text = "BOOLEAN (TRUE/FALSE) FIELDS\r\n\r\nFind books that you haven\'t rated:\r\n -IsRated"; // // label5 // diff --git a/REFERENCE.txt b/REFERENCE.txt index fdf88108..14542ad4 100644 --- a/REFERENCE.txt +++ b/REFERENCE.txt @@ -1,6 +1,7 @@ -- begin VERSIONING --------------------------------------------------------------------------------------------------------------------- https://github.com/rmcrackan/Libation/releases +v3.1.4 : Bugfix: IsAuthorNarrated was returning no books v3.1.3 : fix weirdness with build number v3.1.2 : minor bug fixes v3.1.1 : Check if upgrade available on github