Project

General

Profile

Feature #30893 » 30893-show-updated-issues.patch

Yuichi HARADA, 2019-03-07 09:33

View differences:

app/controllers/users_controller.rb
:total => Issue.visible.where(:author_id => @user.id).count,
:open => Issue.visible.open.where(:author_id => @user.id).count
}
updated_issue_counts = Issue.joins(:journals, :status).merge(Journal.where(:user_id => @user.id)).visible.distinct.group(IssueStatus.arel_table[:is_closed]).count
@issue_counts[:updated] = {
:total => updated_issue_counts.values.sum,
:open => updated_issue_counts.detect{|k,v| break v unless ActiveRecord::Type::Boolean.new.cast(k)} || 0,
}
respond_to do |format|
format.html {
app/views/users/show.html.erb
issues_path(:set_filter => 1, :status_id => '*', :author_id => @user.id, :sort => sort_cond) %>
</td>
</tr>
<tr>
<td class="name">
<%= link_to l(:label_updated_issues),
issues_path(:set_filter => 1, :updated_by => @user.id, :sort => sort_cond) %>
</td>
<td>
<%= link_to @issue_counts[:updated][:open],
issues_path(:set_filter => 1, :updated_by=> @user.id, :sort => sort_cond) %>
</td>
<td>
<%= link_to @issue_counts[:updated][:total] - @issue_counts[:updated][:open],
issues_path(:set_filter => 1, :status_id => 'c', :updated_by => @user.id, :sort => sort_cond) %>
</td>
<td class="total">
<%= link_to @issue_counts[:updated][:total],
issues_path(:set_filter => 1, :status_id => '*', :updated_by => @user.id, :sort => sort_cond) %>
</td>
</tr>
</tbody>
</table>
config/locales/en.yml
label_reported_issues: Reported issues
label_assigned_issues: Assigned issues
label_assigned_to_me_issues: Issues assigned to me
label_updated_issues: Updated issues
label_last_login: Last connection
label_registered_on: Registered on
label_activity: Activity
test/functional/users_controller_test.rb
:custom_fields, :custom_values, :groups_users,
:auth_sources,
:enabled_modules,
:issues, :issue_statuses,
:issues, :issue_statuses, :journals,
:trackers
def setup
......
assert_select 'td:nth-of-type(3)>a', :text => '2' # closed
assert_select 'td:nth-of-type(4)>a', :text => '13' # total
end
assert_select 'tr:nth-of-type(3)' do
assert_select 'td:nth-of-type(1)>a', :text => 'Updated issues'
assert_select 'td:nth-of-type(2)>a', :text => '3' # open
assert_select 'td:nth-of-type(3)>a', :text => '0' # closed
assert_select 'td:nth-of-type(4)>a', :text => '3' # total
end
end
end
(2-2/2)