From c12eeea4c3d0c03dc1275948977098da598dc931 Mon Sep 17 00:00:00 2001 From: Bandana Date: Wed, 26 Oct 2016 19:56:08 +0530 Subject: [PATCH] Scoring of closed issue should not be done. Fixed in this commit. . --- app/models/activity.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/models/activity.rb b/app/models/activity.rb index f267b23a..39bd6f87 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -50,12 +50,20 @@ class Activity end def calculate_score_and_set - words = description.to_s.split(/\W+/) - self.auto_score = case words.length - when 0..25 then 0 - when 26..40 then 1 - else 2 - end + # Scoring of only opened_issue, reopened_issue and created_comment should be done, for others score should be zero + # Here event_type would be either issue or comment. + # For event_type :issue and event_action ["opened", "reopened"] scoring should be done + # And for event_type :comment and event_action ["created"] scoring should be done + if ActivitiesFetcher::TRACKING_EVENTS.values.include?(event_type) and eval "#{event_type.upcase}_CONSIDERED_FOR_SCORING.include?(event_action)" + words = description.to_s.split(/\W+/) + self.auto_score = case words.length + when 0..25 then 0 + when 26..40 then 1 + else 2 + end + else + self.auto_score = 0 + end self.save end