I'm looking for a part-time remote job.

Hire me


I'm the author of:

Mastering Redmine is a comprehensive guide with tips, tricks and best practices, and an easy-to-learn structure.

Check the book's project or

Buy the book

Social pages of the book:

By buying this book you also donate to Redmine (see this page).


Follow me:

Add remaining time column to issues list

Added by Ted Lilley about 11 years ago

Thanks for the fantastic plugin. I’m already using it to replace custom code I hacked into redmine to support mailto links in custom fields containing email addresses. The plugin is very flexible.

I’m also trying to replace some other functionality that I never quite got to work.

I need the issues list for certain projects to show the remaining time on the issue. We use it to track support contracts that come in blocks of time. The blocks get entered as estimated time, and then we use the time logging feature to charge against that time. When the issue runs out of time, the customer needs to purchase a new block.

The administrator of the program needs to routinely determine how much time is left on each support contract. I’d like to do it through the issues list by adding a column for remaining time. It would be a calculated column that just subtracts the spent time from the estimated time.

It looks like the extended fields plugin could handle this easily, but I just don’t have the know-how to figure out how to make it do it. I’ve looked at the extended columns for Projects and Users (I’m using Redmine 2.3 and the latest ef plugin). I just don’t know how to do it for issues.

Any pointers would be appreciated.


Replies (9)

RE: Add remaining time column to issues list - Added by Andriy Lesyuk about 11 years ago

Hi, Ted! I’m very glad to see you on my site. Recently I came across your Redmine tools for Docker. Great work, by the way! Also happy, that you liked the plugin!

For the issue list the plugin uses ExtendedQueryColumn. Such columns are added using Query.add_available_column. Check source:init.rb.
This way the following issue columns are implemented: Notes, Changes and Watchers.

In your case you will need to use lambda for the :value parameter. But implementation of blocks is out of the plugin’s scope (I guess you already have some code for it?).

RE: Add remaining time column to issues list - Added by Ted Lilley about 11 years ago

Awesome, glad you saw it. It’s a bit complicated to containerize a Rails app, but I’m trying.

Thanks for the pointer, I think I get it. I ran into a new problem when I tried what you said though.

I may have something broken with my install. The extension shows up in the plugins list, and the new custom field types are available as well as my custom field templates working.

However the new issue fields aren’t available. I went to the issues list and the normal fields are there, but the notes, changes and watchers columns cannot be added under the options dropdown.

The projects list also doesn’t have the issues-style presentation, just the normal long list. Nevermind, I found the column-query view in Administration > Projects. I was looking at the regular Projects list.

Here’s a clip from the log when rendering the issues list:

Rendered queries/_filters.html.erb (9.4ms)
  Rendered queries/_columns.html.erb (3.0ms)
  UserPreference Load (0.2ms)  SELECT "user_preferences".* FROM "user_preferences" WHERE "user_preferences"."user_id" = 1 LIMIT 1
  Rendered plugins/extended_fields/app/views/issues/_list.html.erb (12.8ms)

I checked for any settings that might be required in Administration or the project’s Settings tab, but I don’t see anything. Am I doing something wrong, or is this unexpected behavior?

I’m on the 2.3-stable branch of Redmine.

RE: Add remaining time column to issues list - Added by Andriy Lesyuk about 11 years ago

Possibly, you have just found a bug. Checking it.

RE: Add remaining time column to issues list - Added by Andriy Lesyuk about 11 years ago

Yes, it was a bug! Thanks, Ted, for finding it!

It was fixed in r102 and r103. Generally, all you need is to replace Query.add_available_column with IssueQuery.add_available_column (the plugin uses a more complex fix to support older Redmine versions)...

RE: Add remaining time column to issues list - Added by Ted Lilley about 11 years ago

I grabbed your latest from svn, but when I try to install it and run migrations I get:

rake aborted!
uninitialized constant ExtendedFieldsHelper
/redmine/plugins/extended-fields/init.rb:38:in `block in <top (required)>'
/redmine/config/environment.rb:14:in `<top (required)>'
Tasks: TOP => redmine:plugins:migrate => environment
(See full trace by running task with --trace)

RE: Add remaining time column to issues list - Added by Andriy Lesyuk about 11 years ago

That’s weird, as I did not seem to change anything related to ExtendedFieldsHelper...

Try moving extended_fields_helper.rb from app/helpers to lib.

RE: Add remaining time column to issues list - Added by Ted Lilley about 11 years ago

Sorry for just getting back to you now, you know how it is with work.

The mistake I made was pulling the entirety of your latest code from svn, not just `init.rb`. I pulled just that and it works fine.

I’ll be getting back to my original effort of adding a calculated remaining time field. If I run into problems I’ll post.

RE: Add remaining time column to issues list - Added by Ted Lilley about 11 years ago

Say, how do I pull IssueQuery into my plugin?

I don’t know how to navigate the namespaces of separate plugins. Thanks.

RE: Add remaining time column to issues list - Added by Ted Lilley about 11 years ago

Just to follow up, I figured everything out and extended fields is working great (with a minor exception, I’ll start a new thread on that).

To use the IssueQuery in my extension, I just had to use:

require_relative '../extended_fields/lib/extended_query_column'

    (1-9/9)

    Terms of use | Privacy policy