Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract method in find similar reviews to help clean up the code a li…

…ttle bit.
  • Loading branch information...
commit 384e0efec6fb52d8bd6257e925a5a7723938b435 1 parent f0c9f84
@robertgreiner authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 Recommender/Common/FindSimilarReviews.cs
View
7 Recommender/Common/FindSimilarReviews.cs
@@ -16,7 +16,12 @@ public FindSimilarReviews(Dictionary<string, double> firstUserReviews, Dictionar
public List<string> Calculate()
{
- return (from r in FirstUserReviews where DoesReviewExistInSecondUserReviews(r) && IsReviewValid(r.Value) && IsReviewValid(SecondUserReviews[r.Key]) select r.Key).ToList();
+ return (from r in FirstUserReviews where ShouldCountSimilarReview(r) select r.Key).ToList();
+ }
+
+ private bool ShouldCountSimilarReview(KeyValuePair<string, double> r)
+ {
+ return DoesReviewExistInSecondUserReviews(r) && IsReviewValid(r.Value) && IsReviewValid(SecondUserReviews[r.Key]);
}
private static bool IsReviewValid(double value)
Please sign in to comment.
Something went wrong with that request. Please try again.