Project

General

Profile

Add Issue Custom Week Column

Added by Ega Rifqi Saputra over 3 years ago

Hello,

I'm new in redmine platform. I still confused how to add custom week column in available week in issue.
What I want to do is add another available column named "Week" or "Start Week". And that's actually copying current Start Date column, but it in Week format.
Is it possible to add custom column like that?

I've already tried to add some code,

../app/models/issue_query.rb
QueryColumn.new(:week_start, :sortable => "#{Issue.table_name}.week_start", :groupable => true),

../app/models/project.rb, actually copying start_date function

def week_start
@week_start ||=
[
issues.minimum('start_date'),
shared_versions.minimum('effective_date'),
Issue.fixed_version(shared_versions).minimum('start_date')
].compact.min
end

../app/models/version.rb, actually copying start_date function

def week_start
@week_start ||= fixed_issues.minimum('start_date')
end

This week column is appeared in available column, but after I add the column, it becom 500 internal server error.

I've get error,

Rendered issues/_list.html.erb (20.7ms)
Rendered my/blocks/_issues.erb (28.0ms)
Rendered my/page.html.erb within layouts/base (254.2ms)
Completed 500 Internal Server Error in 1160ms (ActiveRecord: 36.9ms)

ActionView::Template::Error (undefined method `week_start' for #<Issue:0x0000561de2fd6758>):
33: <% end >
34: <tr id="issue-<
= issue.id >" class="hascontextmenu <= cycle('odd', 'even') > <= issue.css_classes > <= level > 0 ? "idnt idnt-#{level}" : nil >">
35: <td class="checkbox hide-when-print"><
= check_box_tag("ids[]", issue.id, false, :id => nil) ></td>
36: <
query.inline_columns.each do |column| >
37: <
= content_tag('td', column_content(column, issue), :class => column.css_classes) >
38: <
end >
39: <td class="buttons"><
= link_to_context_menu %></td>

Is there any other way I can add week column? or it's even possible?

Thank you