30893-show-updated-issues.patch

Yuichi HARADA, 2019-03-07 09:33

Download (3.42 KB)

View differences:

app/controllers/users_controller.rb
87 87
      :total  => Issue.visible.where(:author_id => @user.id).count,
88 88
      :open   => Issue.visible.open.where(:author_id => @user.id).count
89 89
    }
90
    updated_issue_counts = Issue.joins(:journals, :status).merge(Journal.where(:user_id => @user.id)).visible.distinct.group(IssueStatus.arel_table[:is_closed]).count
91
    @issue_counts[:updated] = {
92
      :total  => updated_issue_counts.values.sum,
93
      :open   => updated_issue_counts.detect{|k,v| break v unless ActiveRecord::Type::Boolean.new.cast(k)} || 0,
94
    }
90 95

  
91 96
    respond_to do |format|
92 97
      format.html {
app/views/users/show.html.erb
72 72
        issues_path(:set_filter => 1, :status_id => '*', :author_id => @user.id, :sort => sort_cond) %>
73 73
    </td>
74 74
  </tr>
75
  <tr>
76
    <td class="name">
77
      <%= link_to l(:label_updated_issues),
78
        issues_path(:set_filter => 1, :updated_by => @user.id, :sort => sort_cond) %>
79
    </td>
80
    <td>
81
      <%= link_to @issue_counts[:updated][:open],
82
        issues_path(:set_filter => 1, :updated_by=> @user.id, :sort => sort_cond) %>
83
    </td>
84
    <td>
85
      <%= link_to @issue_counts[:updated][:total] - @issue_counts[:updated][:open],
86
        issues_path(:set_filter => 1, :status_id => 'c', :updated_by => @user.id, :sort => sort_cond) %>
87
    </td>
88
    <td class="total">
89
      <%= link_to @issue_counts[:updated][:total],
90
        issues_path(:set_filter => 1, :status_id => '*', :updated_by => @user.id, :sort => sort_cond) %>
91
    </td>
92
  </tr>
75 93
</tbody>
76 94
</table>
77 95

  
config/locales/en.yml
624 624
  label_reported_issues: Reported issues
625 625
  label_assigned_issues: Assigned issues
626 626
  label_assigned_to_me_issues: Issues assigned to me
627
  label_updated_issues: Updated issues
627 628
  label_last_login: Last connection
628 629
  label_registered_on: Registered on
629 630
  label_activity: Activity
test/functional/users_controller_test.rb
24 24
           :custom_fields, :custom_values, :groups_users,
25 25
           :auth_sources,
26 26
           :enabled_modules,
27
           :issues, :issue_statuses,
27
           :issues, :issue_statuses, :journals,
28 28
           :trackers
29 29

  
30 30
  def setup
......
201 201
        assert_select 'td:nth-of-type(3)>a', :text => '2'   # closed
202 202
        assert_select 'td:nth-of-type(4)>a', :text => '13'  # total
203 203
      end
204
      assert_select 'tr:nth-of-type(3)' do
205
        assert_select 'td:nth-of-type(1)>a', :text => 'Updated issues'
206
        assert_select 'td:nth-of-type(2)>a', :text => '3'   # open
207
        assert_select 'td:nth-of-type(3)>a', :text => '0'   # closed
208
        assert_select 'td:nth-of-type(4)>a', :text => '3'   # total
209
      end
204 210
    end
205 211
  end
206 212