Sha256: b95d076e30c5047eb9a5b7ebf44ddac7ee5503adf49fe5a3c7e4b7dfadf4b0f3
Contents?: true
Size: 833 Bytes
Versions: 5
Compression:
Stored size: 833 Bytes
Contents
class Report ## # Calculate final values: # * grade # * max_weight # * good_weight,d # * fail_weight # * fail_counter def close app = Application.instance max = 0.0 good = 0.0 fail = 0.0 fail_counter = 0 @lines.each do |i| next unless i.instance_of? Hash max += i[:weight] if i[:weight].positive? if i[:check] good += i[:weight] @history += app.letter[:good] else fail += i[:weight] fail_counter += 1 @history += app.letter[:bad] end end @tail[:max_weight] = max @tail[:good_weight] = good @tail[:fail_weight] = fail @tail[:fail_counter] = fail_counter i = good.to_f / max i = 0 if i.nan? @tail[:grade] = (100.0 * i).round @tail[:grade] = 0 if @tail[:unique_fault].positive? end end
Version data entries
5 entries across 5 versions & 1 rubygems