Feature #824
closedAdd "closed_on" issue field (storing time of last closing) & add it as a column and filter on the issue list.
Added by Rocco Stanzione over 16 years ago. Updated about 10 years ago.
0%
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
Updated by Rocco Stanzione over 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.
Updated by Henrique Bastos over 16 years ago
What would happen if you reopen the issue?
Updated by Robert Hailey almost 13 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.
Updated by Rocco Stanzione almost 13 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.
Updated by Mischa The Evil over 12 years ago
As mentioned in #4730, this feature is provided by the Issue Closed Date plugin
Updated by Anonymous over 11 years ago
Two things to add here:
- 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.
- 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.
Updated by Filou Centrinov over 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
Updated by Jean-Philippe Lang over 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.
Updated by Mischa The Evil over 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.
Updated by Bruno Spyckerelle over 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).
Updated by Mischa The Evil over 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.
Updated by Toshi MARUYAMA about 10 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.
Updated by Jean-Philippe Lang about 9 years ago
- Related to Defect #20210: Issue closed_on date is not reset after issue is reopened added
Updated by Go MAEDA about 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