Skip to content
Snippets Groups Projects
Commit cd64c483 authored by Lucas Kindinger's avatar Lucas Kindinger
Browse files

Fix conflits to score calculator

parent a45ef55e
No related branches found
No related tags found
No related merge requests found
...@@ -4,18 +4,18 @@ class ScoreCalculatorWorker ...@@ -4,18 +4,18 @@ class ScoreCalculatorWorker
include RepositoriesProxy include RepositoriesProxy
def perform(rid) def perform(rid)
# Weights to score. Sum must be 1000
weights = {
"thumbnail": 250,
"description": 150,
"likes": 250,
"views": 150,
"downloads":200
}
object = learning_object_repository.find(rid) object = learning_object_repository.find(rid)
unless object.blank?
# Weights to score. Sum must be 1000
weights = {
"thumbnail": 250,
"description": 150,
"likes": 250,
"views": 150,
"downloads":200
}
score = 0 score = 0
# 250 points if it has thumbnail # 250 points if it has thumbnail
...@@ -35,7 +35,8 @@ class ScoreCalculatorWorker ...@@ -35,7 +35,8 @@ class ScoreCalculatorWorker
downloads = learning_object_repository.count_downloads(object) 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 views < 1
learning_object_repository.update_property(object, 'score', score) learning_object_repository.update_property(object, 'score', score)
end
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment