Permalink
Browse files

Adding turnaround plugin

  • Loading branch information...
1 parent 532e3e0 commit 41c3af88d73ec964fa34963499b280b0615b84ce Steve England committed Jun 16, 2010
@@ -0,0 +1,20 @@
+Copyright (c) 2010 Beef Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
+en:
+ field_time_open: Time Open
@@ -0,0 +1,14 @@
+require 'redmine'
+
+require 'dispatcher'
+Dispatcher.to_prepare do
+ Query.available_columns << QueryColumn.new(:time_open, :sortable => RedmineTurnaroundReport::TIME_SQL, :default_order => 'desc')
+ Issue.send :include, RedmineTurnaroundReport::Issue
+end
+
+Redmine::Plugin.register :turnaround do
+ name 'Redmine Turnaround Plugin'
+ author 'Steve England'
+ description 'Checks how long the time is between the ticket being created and the last update'
+ version '0.0.1'
+end
@@ -0,0 +1,20 @@
+# RedmineBounceReport
+module RedmineTurnaroundReport
+ TIME_SQL = "(#{Issue.table_name}.updated_on - #{Issue.table_name}.created_on)"
+
+ module Issue
+ def time_open
+ @time_open || begin
+ time_elapsed = (self.updated_on - self.created_on).round
+ #find the minutes
+ minutes = (time_elapsed / 60) % 60
+ #find the hours
+ hours = (time_elapsed/3600) % 24
+
+ days = (time_elapsed/3600/24)
+ #format the time
+ @time_open = "#{days}d#{hours}h#{minutes}m"
+ end
+ end
+ end
+end

0 comments on commit 41c3af8

Please sign in to comment.