From 30974204b97a6b0c93c84208415a7f1efcb99e4a Mon Sep 17 00:00:00 2001 From: Carlos Vidal Date: Sat, 9 Jun 2018 15:58:15 +0100 Subject: [PATCH] Revert "target using serialized line coverage" This reverts commit 2c68bfb98386736006e656351df4452eb00e9b55. --- lib/xcov/model/target.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/xcov/model/target.rb b/lib/xcov/model/target.rb index 59d1175..fd6369a 100644 --- a/lib/xcov/model/target.rb +++ b/lib/xcov/model/target.rb @@ -7,10 +7,10 @@ class Target < Xcov::Base attr_accessor :files attr_accessor :file_templates - def initialize(name, coverage, files) + def initialize(name, files) @name = CGI::escapeHTML(name) @files = files - @coverage = coverage + @coverage = files.count == 0 ? 0.0 : files.reduce(0) { |acc, file| acc + file.coverage.to_f } / files.count @displayable_coverage = self.create_displayable_coverage @coverage_color = self.create_coverage_color @id = Target.create_id(name) @@ -53,12 +53,11 @@ def json_value def self.map(dictionary) name = dictionary["name"] - coverage = dictionary["coverage"] files = dictionary["files"].map { |file| Source.map(file)} files = files.sort &by_coverage_with_ignored_at_the_end non_ignored_files = Target.select_non_ignored_files(files) - Target.new(name, coverage, non_ignored_files) + Target.new(name, non_ignored_files) end def self.by_coverage_with_ignored_at_the_end