Permalink
Browse files

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

…ttle bit.
  • Loading branch information...
1 parent f0c9f84 commit 384e0efec6fb52d8bd6257e925a5a7723938b435 @robertgreiner committed Nov 11, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 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)

0 comments on commit 384e0ef

Please sign in to comment.