Formatting
This commit is contained in:
parent
874bf9e7c0
commit
05ac5c63e1
@ -419,7 +419,7 @@ namespace ApplicationServices
|
|||||||
Rating rating = null)
|
Rating rating = null)
|
||||||
=> new[] { book }.UpdateUserDefinedItem(tags, bookStatus, pdfStatus, rating);
|
=> new[] { book }.UpdateUserDefinedItem(tags, bookStatus, pdfStatus, rating);
|
||||||
|
|
||||||
public static int UpdateUserDefinedItem(
|
public static int UpdateUserDefinedItem(
|
||||||
this IEnumerable<Book> books,
|
this IEnumerable<Book> books,
|
||||||
string tags = null,
|
string tags = null,
|
||||||
LiberatedStatus? bookStatus = null,
|
LiberatedStatus? bookStatus = null,
|
||||||
@ -494,10 +494,10 @@ namespace ApplicationServices
|
|||||||
foreach (var book in books)
|
foreach (var book in books)
|
||||||
{
|
{
|
||||||
context.Attach(book.UserDefinedItem).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
context.Attach(book.UserDefinedItem).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
||||||
context.Attach(book.UserDefinedItem.Rating).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
context.Attach(book.UserDefinedItem.Rating).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
var qtyChanges = context.SaveChanges();
|
var qtyChanges = context.SaveChanges();
|
||||||
if (qtyChanges > 0)
|
if (qtyChanges > 0)
|
||||||
BookUserDefinedItemCommitted?.Invoke(null, books);
|
BookUserDefinedItemCommitted?.Invoke(null, books);
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@ namespace DataLayer
|
|||||||
/// <summary>The user's individual book rating</summary>
|
/// <summary>The user's individual book rating</summary>
|
||||||
public Rating Rating { get; private set; } = new Rating(0, 0, 0);
|
public Rating Rating { get; private set; } = new Rating(0, 0, 0);
|
||||||
|
|
||||||
public void UpdateRating(float overallRating, float performanceRating, float storyRating)
|
public void UpdateRating(float overallRating, float performanceRating, float storyRating)
|
||||||
=> Rating.Update(overallRating, performanceRating, storyRating);
|
=> Rating.Update(overallRating, performanceRating, storyRating);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -89,9 +89,9 @@ namespace LibationSearchEngine
|
|||||||
["Hours"] = lb => (lb.Book.LengthInMinutes / 60).ToLuceneString(),
|
["Hours"] = lb => (lb.Book.LengthInMinutes / 60).ToLuceneString(),
|
||||||
|
|
||||||
["ProductRating"] = lb => lb.Book.Rating.OverallRating.ToLuceneString(),
|
["ProductRating"] = lb => lb.Book.Rating.OverallRating.ToLuceneString(),
|
||||||
["Rating"] = lb => lb.Book.Rating.OverallRating.ToLuceneString(),
|
["Rating"] = lb => lb.Book.Rating.OverallRating.ToLuceneString(),
|
||||||
["UserRating"] = lb => userOverallRating(lb.Book),
|
["UserRating"] = lb => userOverallRating(lb.Book),
|
||||||
["MyRating"] = lb => userOverallRating(lb.Book)
|
["MyRating"] = lb => userOverallRating(lb.Book)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ namespace LibationSearchEngine
|
|||||||
return authors.Intersect(narrators).Any();
|
return authors.Intersect(narrators).Any();
|
||||||
}
|
}
|
||||||
private static string userOverallRating(Book book) => book.UserDefinedItem.Rating.OverallRating.ToLuceneString();
|
private static string userOverallRating(Book book) => book.UserDefinedItem.Rating.OverallRating.ToLuceneString();
|
||||||
private static bool isLiberated(Book book) => book.UserDefinedItem.BookStatus == LiberatedStatus.Liberated;
|
private static bool isLiberated(Book book) => book.UserDefinedItem.BookStatus == LiberatedStatus.Liberated;
|
||||||
private static bool liberatedError(Book book) => book.UserDefinedItem.BookStatus == LiberatedStatus.Error;
|
private static bool liberatedError(Book book) => book.UserDefinedItem.BookStatus == LiberatedStatus.Error;
|
||||||
|
|
||||||
// use these common fields in the "all" default search field
|
// use these common fields in the "all" default search field
|
||||||
@ -289,25 +289,25 @@ namespace LibationSearchEngine
|
|||||||
d.AddBool("LiberatedError", v2);
|
d.AddBool("LiberatedError", v2);
|
||||||
});
|
});
|
||||||
|
|
||||||
public void UpdateUserRatings(Book book)
|
public void UpdateUserRatings(Book book)
|
||||||
=> updateDocument(
|
=> updateDocument(
|
||||||
book.AudibleProductId,
|
book.AudibleProductId,
|
||||||
d =>
|
d =>
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// TODO: better synonym handling. This is too easy to mess up
|
// TODO: better synonym handling. This is too easy to mess up
|
||||||
//
|
//
|
||||||
|
|
||||||
// fields are key value pairs. MULTIPLE FIELDS CAN POTENTIALLY HAVE THE SAME KEY.
|
// fields are key value pairs. MULTIPLE FIELDS CAN POTENTIALLY HAVE THE SAME KEY.
|
||||||
// ie: must remove old before adding new else will create unwanted duplicates.
|
// ie: must remove old before adding new else will create unwanted duplicates.
|
||||||
var v1 = userOverallRating(book);
|
var v1 = userOverallRating(book);
|
||||||
d.RemoveField("UserRating");
|
d.RemoveField("UserRating");
|
||||||
d.AddNotAnalyzed("UserRating", v1);
|
d.AddNotAnalyzed("UserRating", v1);
|
||||||
d.RemoveField("MyRating");
|
d.RemoveField("MyRating");
|
||||||
d.AddNotAnalyzed("MyRating", v1);
|
d.AddNotAnalyzed("MyRating", v1);
|
||||||
});
|
});
|
||||||
|
|
||||||
private static void updateDocument(string productId, Action<Document> action)
|
private static void updateDocument(string productId, Action<Document> action)
|
||||||
{
|
{
|
||||||
var productTerm = new Term(_ID_, productId);
|
var productTerm = new Term(_ID_, productId);
|
||||||
|
|
||||||
|
|||||||
@ -51,8 +51,6 @@ namespace LibationWinForms.GridView
|
|||||||
propertyInfo.SetValue(gridEntryDataGridView, true, null);
|
propertyInfo.SetValue(gridEntryDataGridView, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Button controls
|
#region Button controls
|
||||||
private void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
private void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user