mirror of
https://github.com/redmine/redmine.git
synced 2025-11-12 16:26:03 +01:00
Add estimated hours and spent hours to Versions API (#32242).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@18883 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -8,6 +8,10 @@ api.version do
|
|||||||
api.due_date @version.effective_date
|
api.due_date @version.effective_date
|
||||||
api.sharing @version.sharing
|
api.sharing @version.sharing
|
||||||
api.wiki_page_title @version.wiki_page_title
|
api.wiki_page_title @version.wiki_page_title
|
||||||
|
if User.current.allowed_to?(:view_time_entries, @project)
|
||||||
|
api.estimated_hours(@version.visible_fixed_issues.estimated_hours)
|
||||||
|
api.spent_hours(@version.spent_hours)
|
||||||
|
end
|
||||||
|
|
||||||
render_api_custom_values @version.visible_custom_field_values, api
|
render_api_custom_values @version.visible_custom_field_values, api
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
|
|||||||
:members,
|
:members,
|
||||||
:enabled_modules,
|
:enabled_modules,
|
||||||
:versions,
|
:versions,
|
||||||
:wikis, :wiki_pages
|
:wikis, :wiki_pages,
|
||||||
|
:time_entries
|
||||||
|
|
||||||
test "GET /projects/:project_id/versions.xml should return project versions" do
|
test "GET /projects/:project_id/versions.xml should return project versions" do
|
||||||
get '/projects/1/versions.xml'
|
get '/projects/1/versions.xml'
|
||||||
@@ -125,6 +126,10 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "GET /versions/:id.xml should return the version" do
|
test "GET /versions/:id.xml should return the version" do
|
||||||
|
assert_equal [2, 12], Version.find(2).visible_fixed_issues.pluck(:id).sort
|
||||||
|
TimeEntry.generate!(:issue_id => 2, :hours => 1.0)
|
||||||
|
TimeEntry.generate!(:issue_id => 12, :hours => 1.5)
|
||||||
|
|
||||||
get '/versions/2.xml'
|
get '/versions/2.xml'
|
||||||
|
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@@ -134,6 +139,8 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
|
|||||||
assert_select 'name', :text => '1.0'
|
assert_select 'name', :text => '1.0'
|
||||||
assert_select 'sharing', :text => 'none'
|
assert_select 'sharing', :text => 'none'
|
||||||
assert_select 'wiki_page_title', :text => 'ECookBookV1'
|
assert_select 'wiki_page_title', :text => 'ECookBookV1'
|
||||||
|
assert_select 'estimated_hours', :text => '0.5'
|
||||||
|
assert_select 'spent_hours', :text => '2.5'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user