From e64a7dabc75d96f1b634d7e24ff49baddda82835 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 2 Mar 2015 14:29:02 +0100 Subject: [PATCH] fix bug with extra duplicated line in the popup --- .../hbs/source-viewer/source-viewer-duplication-popup.hbs | 2 +- server/sonar-web/src/main/js/common/handlebars-extensions.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/sonar-web/src/main/hbs/source-viewer/source-viewer-duplication-popup.hbs b/server/sonar-web/src/main/hbs/source-viewer/source-viewer-duplication-popup.hbs index 2e83c813a0e..79947f601c6 100644 --- a/server/sonar-web/src/main/hbs/source-viewer/source-viewer-duplication-popup.hbs +++ b/server/sonar-web/src/main/hbs/source-viewer/source-viewer-duplication-popup.hbs @@ -28,7 +28,7 @@ Lines: {{#joinEach blocks ','}} - {{from}} – {{sum from size}} + {{from}} – {{sum from size -1}} {{/joinEach}} diff --git a/server/sonar-web/src/main/js/common/handlebars-extensions.js b/server/sonar-web/src/main/js/common/handlebars-extensions.js index 36f89fd0214..006a6abaa81 100644 --- a/server/sonar-web/src/main/js/common/handlebars-extensions.js +++ b/server/sonar-web/src/main/js/common/handlebars-extensions.js @@ -259,7 +259,10 @@ }); Handlebars.registerHelper('sum', function(a, b) { - return a + b; + var args = Array.prototype.slice.call(arguments, 0, -1); + return args.reduce(function (p, c) { + return p + +c; + }, 0); }); Handlebars.registerHelper('dashboardUrl', function(componentKey, componentQualifier) { -- 2.39.5