File 0010-Reports-Show-diff-from-the-past-not-to-the-future-bs.patch of Package hawk2.3651
From 48c2d80e2894ae87c2ceda4ebaf71b45c925fb4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
Date: Thu, 17 Nov 2016 08:53:06 +0100
Subject: [PATCH 10/10] Reports: Show diff from the past, not to the future
(bsc#1010602)
---
hawk/app/controllers/reports_controller.rb | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hawk/app/controllers/reports_controller.rb b/hawk/app/controllers/reports_controller.rb
index d028d80..4a430b5 100644
--- a/hawk/app/controllers/reports_controller.rb
+++ b/hawk/app/controllers/reports_controller.rb
@@ -208,16 +208,12 @@ class ReportsController < ApplicationController
def diff
tidx = @transition[:index]
- if tidx >= 0 && tidx < @transitions.length-1 && @transitions.length > 1
- l = @transitions[tidx][:path]
- r = @transitions[tidx+1][:path]
- @transition[:diff] = @report.diff(@hb_report, @transition[:path], l, r, :html)
- elsif tidx == @transitions.length-1 && @transitions.length > 1
+ if tidx > 0 && tidx < @transitions.length
l = @transitions[tidx-1][:path]
r = @transitions[tidx][:path]
@transition[:diff] = @report.diff(@hb_report, @transition[:path], l, r, :html)
else
- @transition[:diff] = _("Cannot display diff, too few transitions")
+ @transition[:diff] = _("Cannot display diff for initial transition.")
end
respond_to do |format|
--
2.10.1