Project

General

Profile

Help for plugin / modified issues list: display column for "spent time"

Added by Carsten Buchenau over 13 years ago

Hi,

On the Issues list, I'd like to be able to display an additional column, "Spent time", which displays the overall spent time as collected by the time tracker module for each issue.

I tried by creating a custom view, but realized that - ideally - this should be a selectable column as we can do in Administration / Settings / Issue tracking.

Any idea if I can accomplish this with a plugin? Or is it something deeper inside Redmine?

Thanks for any help,
carsten


Replies (1)

RE: Help for plugin / modified issues list: display column for "spent time" - Added by Carsten Buchenau over 13 years ago

Ok, I solved it the following way:

  • Installed Eric Davis' Question plugin (http://github.com/edavis10/question_plugin)
  • Modified lib/question_query_patch.rb to add one line of code, making the "Spent time" column available
  • Added translations for "field_spent_hours

Here's the line of code I added, and its location inside lib/question_query_patch.rb:

module QuestionQueryPatch
  def self.included(base) # :nodoc:
    base.extend(ClassMethods)

    base.send(:include, InstanceMethods)

    # Same as typing in the class
    base.class_eval do
      unloadable # Send unloadable so it will not be unloaded in development
      base.add_available_column(QueryColumn.new(:formatted_questions))
      #
      # ADD ADDITIONAL COLUMN TO SHOW "Spent time":
      base.add_available_column(QueryColumn.new(:spent_hours))

...

Thanks to this thread for pointing me the right way:
http://stackoverflow.com/questions/321403/redmine-add-spent-time-field-to-issues-display

carsten

    (1-1/1)