lib/lazylead/task/accuracy/accuracy.rb in lazylead-0.5.0 vs lib/lazylead/task/accuracy/accuracy.rb in lazylead-0.5.1

- old
+ new

@@ -79,11 +79,11 @@ # Post the comment with score and accuracy to the ticket. def post return if @opts.key? "silent" @issue.post comment - @issue.add_label "LL.accuracy", "#{(@accuracy / 10) * 10}%" + @issue.add_label "LL.accuracy", grade(@accuracy) end # The jira comment in markdown format def comment comment = [ @@ -129,8 +129,17 @@ .to_h .to_a .each { |e| e[0] = e[0].to_i } .sort_by { |e| e[0] } end + end + + # Calculate grade for accuracy + # For example, + # grade(7.5) => 0 + # grade(12) => 10 + # grade(25.5) => 20 + def grade(value) + (value / 10).floor * 10 end end end