Project

General

Profile

Feature #32242 ยป 32242_total_hours_by_fixed_version.patch

Yuichi HARADA, 2019-10-28 05:28

View differences:

app/views/versions/show.api.rsb
1 1
api.version do
2 2
  api.id @version.id
3
  api.project(:id => @version.project_id, :name => @version.project.name) unless @version.project.nil?
3
  api.project(:id => @project.id, :name => @project.name) unless @project.nil?
4 4

  
5 5
  api.name            @version.name
6 6
  api.description     @version.description
......
8 8
  api.due_date        @version.effective_date
9 9
  api.sharing         @version.sharing
10 10
  api.wiki_page_title @version.wiki_page_title
11
  if User.current.allowed_to?(:view_time_entries, @project)
12
    api.estimated_hours(@version.visible_fixed_issues.estimated_hours)
13
    api.spent_hours(@version.spent_hours)
14
  end
11 15

  
12 16
  render_api_custom_values @version.visible_custom_field_values, api
13 17

  
test/integration/api_test/versions_test.rb
28 28
           :members,
29 29
           :enabled_modules,
30 30
           :versions,
31
           :wikis, :wiki_pages
31
           :wikis, :wiki_pages,
32
           :custom_fields, :time_entries
32 33

  
33 34
  test "GET /projects/:project_id/versions.xml should return project versions" do
34 35
    get '/projects/1/versions.xml'
......
125 126
  end
126 127

  
127 128
  test "GET /versions/:id.xml should return the version" do
129
    assert_equal [2, 12], Version.find(2).visible_fixed_issues.pluck(:id).sort
130
    TimeEntry.generate!(:issue_id => 2, :hours => 1.0)
131
    TimeEntry.generate!(:issue_id => 12, :hours => 1.5)
132

  
128 133
    get '/versions/2.xml'
129 134

  
130 135
    assert_response :success
......
134 139
      assert_select 'name', :text => '1.0'
135 140
      assert_select 'sharing', :text => 'none'
136 141
      assert_select 'wiki_page_title', :text => 'ECookBookV1'
142
      assert_select 'estimated_hours', :text => '0.5'
143
      assert_select 'spent_hours', :text => '2.5'
137 144
    end
138 145
  end
139 146

  
    (1-1/1)