From e2576d588fef876e743f55b0b5b0620da43ab1c1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 1 Oct 2015 15:51:28 +0200 Subject: Avoid unnecessary usage of local vars Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/diffs/_diffs.html.haml | 5 +---- app/views/projects/diffs/_stats.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml index ac2461b3b24..4f1965bfb39 100644 --- a/app/views/projects/diffs/_diffs.html.haml +++ b/app/views/projects/diffs/_diffs.html.haml @@ -8,10 +8,7 @@ .btn-group = inline_diff_btn = parallel_diff_btn - - additions = diff_files.sum(&:added_lines) - - deletions = diff_files.sum(&:removed_lines) - = render 'projects/diffs/stats', diff_files: diff_files, - additions: additions, deletions: deletions + = render 'projects/diffs/stats', diff_files: diff_files - if diff_files.count < diffs.size = render 'projects/diffs/warning', diffs: diffs, shown_files_count: diff_files.count diff --git a/app/views/projects/diffs/_stats.html.haml b/app/views/projects/diffs/_stats.html.haml index 9e49716f7a7..ea2a3e01277 100644 --- a/app/views/projects/diffs/_stats.html.haml +++ b/app/views/projects/diffs/_stats.html.haml @@ -4,9 +4,9 @@ = link_to '#', class: 'js-toggle-button' do %strong #{pluralize(diff_files.count, "changed file")} with - %strong.cgreen #{additions} additions + %strong.cgreen #{diff_files.sum(&:added_lines)} additions and - %strong.cred #{deletions} deletions + %strong.cred #{diff_files.sum(&:removed_lines)} deletions .file-stats.js-toggle-content.hide %ul - diff_files.each_with_index do |diff_file, i| -- cgit v1.2.1