diff --git a/app/workers/score_calculator_worker.rb b/app/workers/score_calculator_worker.rb index 67cf84bafbaf6e4130ab060e346e77545278571b..6f1f6f99d15cd16480111219be944ee79ab6ccc3 100644 --- a/app/workers/score_calculator_worker.rb +++ b/app/workers/score_calculator_worker.rb @@ -19,10 +19,10 @@ class ScoreCalculatorWorker score = 0 # 250 points if it has thumbnail - score += weights[:thumbnail] unless object.thumbnail.empty? + score += weights[:thumbnail] unless object.thumbnail.blank? # 150 points if it has description - score += weights[:description] unless object.description.empty? + score += weights[:description] unless object.description.blank? # range to 250 points, for normalized likes ( maxLikes/actualLike => [0..1] ) likes = learning_object_repository.count_likes(object) @@ -33,7 +33,7 @@ class ScoreCalculatorWorker score += (views / learning_object_repository.max_views)*weights[:views] unless views < 1 downloads = learning_object_repository.count_downloads(object) - score += (downloads / learning_object_repository.max_downloads)*weights[:downloads] unless views < 1 + score += (downloads / learning_object_repository.max_downloads)*weights[:downloads] unless downloads < 1 learning_object_repository.update_property(object, 'score', score) end