Permalink
Browse files

0.1.1 Release - Added aggregation at the Version level for Harvest times

  • Loading branch information...
1 parent 1b5a311 commit 996df6631b401e4f3bb333771a5888e834475bb2 Jim Mulholland committed Mar 27, 2010
View
@@ -0,0 +1,11 @@
+0.1.1 (3-27-2010):
+ * Feature: Added project-menu item (tab) highlighting
+ * Add changelog file
+ * Add license file
+
+
+0.1.0 (12-17-2009):
+ - Fix issue caused by Harvest API update
+
+0.0.1 (11-17-2009):
+ - Initial public release
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -4,6 +4,8 @@ class HarvestReportsController < ApplicationController
include SortHelper
unloadable
+ menu_item :harvest
+
before_filter :find_project, :authorize
before_filter :import_time
View
@@ -17,6 +17,16 @@ def self.user_id(user)
harvest_user_id = custom_value.value.to_i if custom_value
end
+ def self.harvest_time_by_version(version)
+ HarvestTime.sum(:hours, :include => :issue, :conditions => ["#{Issue.table_name}.fixed_version_id = ?", version.id]).to_f
+ end
+
+ def self.ticket_points_by_version(version)
+ Issue.all(:conditions => {:fixed_version_id => version.id}).map do |issue|
+ issue.custom_field_values.find {|v| v.custom_field.name =~ /points/i}.value.to_i
+ end.sum rescue 0
+ end
+
def self.import_time(project)
harvest_project_id = self.project_id(project)
#harvest_project_id = 408960
@@ -0,0 +1,27 @@
+<% harvest_time = HarvestTime.harvest_time_by_version(@version) %>
+<% ticket_points = HarvestTime.ticket_points_by_version(@version) %>
+
+
+<div id="version-harvest" style="float: left">
+ <fieldset>
+ <legend>Harvest Time</legend>
+ <table>
+ <% if @version.estimated_hours > 0%>
+ <tr>
+ <td width="120px" align="right"><%= l(:field_estimated_hours) %>:</td>
+ <td width="150px" align="right" style="font-size: 110%; font-weight: bold"><%= html_hours(l_hours(@version.estimated_hours)) %></td>
+ </tr>
+ <% end %>
+ <% if ticket_points > 0%>
+ <tr>
+ <td width="120px" align="right">Points:</td>
+ <td width="150px" align="right" style="font-size: 110%; font-weight: bold"><%= ticket_points %></td>
+ </tr>
+ <% end %>
+ <tr>
+ <td width="120px" align="right">Time From Harvest:</td>
+ <td width="150px" align="right" style="font-size: 110%; font-weight: bold"><%= html_hours(l_hours(harvest_time)) %></td>
+ </tr>
+ </table>
+ </fieldset>
+</div>
@@ -0,0 +1,9 @@
+div#version-harvest {
+ position: absolute;
+ background-color:#FFFFFF;
+ float:right;
+ margin-bottom:16px;
+ margin-left:16px;
+ position:absolute;
+ width:380px;
+}
View
@@ -15,7 +15,7 @@
name 'Redmine Harvest plugin'
author 'Jim Mulholland'
description 'This is a plugin for Redmine to import project timesheet data from Harvest.'
- version '0.0.2'
+ version '0.1.0'
# This plugin contains settings
settings :default => {
@@ -2,6 +2,7 @@ module Harvest
module Hooks
class HarvestHooks < Redmine::Hook::ViewListener
render_on :view_issues_show_details_bottom, :partial => "issues/show_harvest_time"
+ render_on :view_versions_show_bottom, :partial => "versions/show_harvest_time"
end
end
end

0 comments on commit 996df66

Please sign in to comment.