Project

General

Profile

Actions

Feature #824

closed

Add "closed_on" issue field (storing time of last closing) & add it as a column and filter on the issue list.

Added by Rocco Stanzione about 16 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Start date:
2008-03-10
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

In our regular planning sessions we like to see what issues were closed in the last, say, week. The closest thing we have is closed? and updated_on, which isn't always accurate (sometimes closed issues get modified). It would be nice to have a closed_on field on the issues table that gets updated when the status changes from not-closed to closed.


Related issues

Related to Redmine - Defect #20210: Issue closed_on date is not reset after issue is reopenedClosed

Actions
Related to Redmine - Defect #31420: issues-table; closed_on - column should be updated to NULL whenever issue's status is changed to a 'is_closed == 0' statusClosed

Actions
Has duplicate Redmine - Feature #13014: Record issue closing dateClosed

Actions
Has duplicate Redmine - Feature #2225: Provide a Date Closed element for queriesClosed2008-11-24

Actions
Blocks Redmine - Feature #4730: Add Closed Date to Issue FilterClosed2010-02-03

Actions
Blocks Redmine - Feature #6795: View issue close date on the gantt viewNew2010-11-02

Actions
Blocks Redmine - Feature #5705: Display Issue Closed Date on Calendar ViewNew2010-06-17

Actions
Actions #1

Updated by Rocco Stanzione about 16 years ago

I looked into implementing this, and it might have to get a little invasive. I was thinking instead of setting @issue_before_change in init_journal, do something like:

attr_reader :original_attributes
def after_find
  original_attributes = attributes
end

Then anywhere you need to, you can access the original_attributes hash to see what's being changed with this save. So in before_save, you could:

closed_at = Time.now if IssueStatus.find(original_attributes.status_id).is_closed? && !self.closed

Or to save some syntax you could clone the whole issue into an :original_issue attr_reader.

Actions #2

Updated by Henrique Bastos almost 16 years ago

What would happen if you reopen the issue?

Actions #3

Updated by Robert Hailey over 12 years ago

Henrique Bastos wrote:

What would happen if you reopen the issue?

The answer to this question seems obvious, but I suppose it might as well be stated....

In that case it would maintain it's previous closed_on attribute, which would be updated again later if/when it is re-closed. The fact that the issue was reopened does not change the fact that it was once closed.

Actions #4

Updated by Rocco Stanzione over 12 years ago

I'm not sure I agree. If I search for issues closed in the last 7 days, I don't think I should need a separate filter to constrain the search to issues that are currently closed, and I don't think the data in closed_on is useful for issues that aren't closed.

Actions #5

Updated by Mischa The Evil over 12 years ago

As mentioned in #4730, this feature is provided by the Issue Closed Date plugin

Actions #6

Updated by Daniel Felix over 11 years ago

+1 for core implementation.

Actions #7

Updated by Anonymous about 11 years ago

Two things to add here:

  1. I agree with leaving a closed field populated even after reopening. Requiring an extra filter is added robustness, not tedium, and allows you to rapidly filter issues that were previously closed regardless of their current status. Everything gained by keeping this value recorded outweighs this one extra act of filtering for one particular use case.
  2. I highly recommend the Custom Workflows plugin to achieve this in the meantime. It's much more versatile than a dedicated plugin for this purpose, and is much more likely to maintained (already the Issue Closed Date plugin is far out of date). If using this plugin, here's my junky contribution to the topic:
if @issue.status_id_changed?
  if @issue.closing?
    @issue.custom_field_values = {'1' => Time.now.strftime("%Y-%m-%d")}
    # Where 1 is the ID of a 'closed on' date custom field
  end
end

Create a custom field, date type, for the closing date value. Make note of its ID. Create a new custom workflow with the above in the before-saving box, replacing the ID with the one you'll be using. Enable the field and the script on whatever trackers and projects you want this recorded for.

I advise this over a single-use plugin because this one plugin will give you this plus everything else it can do, and that means more customization with fewer plugin dependencies in your Redmine build.

Actions #8

Updated by Filou Centrinov about 11 years ago

Henrique Bastos wrote:

What would happen if you reopen the issue?

Always show the date of last closed status. If never has been closed before, don't show any date.
+1

Actions #9

Updated by Jean-Philippe Lang about 11 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.3.0
  • Resolution set to Fixed

Feature added.

Filou Centrinov wrote:

Always show the date of last closed status. If never has been closed before, don't show any date.

This is how it was implemented as most people requested this behaviour. The closed_on column is preserved when the issue is reopened.

Actions #10

Updated by Mischa The Evil about 11 years ago

  • Subject changed from "closed_on" issues field to Add "closed_on" issue field (storing time of last closing) & add it as a column and filter on the issue list.

For roadmap/changelog: extending subject to better circumscribe the new feature.

Actions #11

Updated by Bruno Spyckerelle about 11 years ago

It would be very usefull to be able to change the closed_on date as we can change the start and due dates (for example if someone forgot to close the issue and we want to record the real closed_on date).

Actions #12

Updated by Mischa The Evil about 11 years ago

Bruno Spyckerelle wrote:

It would be very usefull to be able to change the closed_on date as we can change the start and due dates (for example if someone forgot to close the issue and we want to record the real closed_on date).

Please open a new feature request for this. This issue is completed and released.

Actions #13

Updated by Toshi MARUYAMA over 9 years ago

Mischa The Evil wrote:

Bruno Spyckerelle wrote:

It would be very usefull to be able to change the closed_on date as we can change the start and due dates (for example if someone forgot to close the issue and we want to record the real closed_on date).

Please open a new feature request for this. This issue is completed and released.

FTR: There is #8002 already.

Actions #14

Updated by Jean-Philippe Lang almost 9 years ago

  • Related to Defect #20210: Issue closed_on date is not reset after issue is reopened added
Actions #15

Updated by Go MAEDA almost 5 years ago

  • Related to Defect #31420: issues-table; closed_on - column should be updated to NULL whenever issue's status is changed to a 'is_closed == 0' status added
Actions

Also available in: Atom PDF