Project

General

Profile

Actions

Feature #34258

closed

Create tracker by copy

Added by Go MAEDA about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Administration
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

When there are many custom fields or projects, configuring a new tracker is painful work. Imagine that there are 300 custom fields in your Redmine instance. You have to check/uncheck 300 checkboxes.

It can be mitigated if Redmine has a feature to copy existing tracker. The feature to copy a role is already exists (#9258).


Files

34258-copy-tracker.patch (6.13 KB) 34258-copy-tracker.patch Takenori TAKAKI, 2020-11-20 09:06

Related issues

Related to Redmine - Feature #9258: Create role by copyClosedJean-Philippe Lang2011-09-16

Actions
Actions #1

Updated by Takenori TAKAKI about 4 years ago

I made a patch to copy the tracker and attach it.
I confirmed that this patch works fine on latest trunk@20441.

Actions #2

Updated by Go MAEDA almost 4 years ago

  • Target version set to Candidate for next major release

Thank you for posting the patch. I think the following change to the patch is necessary to fix an issue that the selection of "Copy workflow from" is cleared after validation error.

diff --git a/app/views/trackers/_form.html.erb b/app/views/trackers/_form.html.erb
index b7c4b773f..2ccd225e6 100644
--- a/app/views/trackers/_form.html.erb
+++ b/app/views/trackers/_form.html.erb
@@ -39,7 +39,7 @@

 <% if @tracker.new_record? && @trackers.any? %>
 <p><label for="copy_workflow_from"><%= l(:label_copy_workflow_from) %></label>
-<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@trackers, :id, :name, @copy_from.try(:id))) %></p>
+<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@trackers, :id, :name, params[:copy_workflow_from] || @copy_from.try(:id))) %></p>
 <% end %>
 <!--[eoform:tracker]-->
 </div>
Actions #3

Updated by Go MAEDA almost 4 years ago

  • Target version changed from Candidate for next major release to 4.2.0

Setting the target version to 4.2.0.

Actions #4

Updated by Takenori TAKAKI almost 4 years ago

Go MAEDA wrote:

Thank you for posting the patch. I think the following change to the patch is necessary to fix an issue that the selection of "Copy workflow from" is cleared after validation error.

Thank you for pointing out.
I confirmed that the proposed code solves the problem in case of Validation error.

Actions #5

Updated by Go MAEDA almost 4 years ago

  • Related to Feature #841: Ability to copy an existing workflow when creating a new role added
Actions #6

Updated by Go MAEDA almost 4 years ago

  • Subject changed from Ability to copy an existing tracker when creating a new tracker to Create tracker by copy
  • Description updated (diff)
Actions #7

Updated by Go MAEDA almost 4 years ago

  • Related to deleted (Feature #841: Ability to copy an existing workflow when creating a new role)
Actions #8

Updated by Go MAEDA almost 4 years ago

Actions #9

Updated by Go MAEDA almost 4 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you.

Actions #10

Updated by Go MAEDA almost 4 years ago

  • Status changed from Closed to Reopened

The test randomly fails due to r20492.

$ bin/rake db:reset RAILS_ENV=test
$ bin/rails test test/unit/tracker_test.rb:65
Run options: --seed 57984

# Running:

E

Error:
TrackerTest#test_copy_from_should_copy_custom_fields:
ActiveRecord::RecordNotFound: Couldn't find all IssueCustomFields with 'id': (1, 2, 6) [WHERE "custom_fields"."type" IN ('IssueCustomField')] (found 0 results, but was looking for 3). Couldn't find IssueCustomFields with ids 1, 2, 6.
    test/object_helpers.rb:68:in `generate'
    test/object_helpers.rb:76:in `generate!'
    test/unit/tracker_test.rb:66:in `test_copy_from_should_copy_custom_fields'

bin/rails test test/unit/tracker_test.rb:65

This can be fixed by adding a fixture.

diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb
index 1f3447da7..d4b383ea3 100644
--- a/test/unit/tracker_test.rb
+++ b/test/unit/tracker_test.rb
@@ -20,7 +20,7 @@
 require File.expand_path('../../test_helper', __FILE__)

 class TrackerTest < ActiveSupport::TestCase
-  fixtures :trackers, :workflows, :issue_statuses, :roles, :issues, :projects, :projects_trackers, :enabled_modules
+  fixtures :trackers, :workflows, :issue_statuses, :roles, :issues, :custom_fields, :projects, :projects_trackers, :enabled_modules

   def setup
     User.current = nil
Actions #11

Updated by Takenori TAKAKI almost 4 years ago

Thanks Go MAEDA.
I could also confirm that the test fails in the environment where the database was rebuilt.
As you pointed out, I missed the addition of fixture on my patch.

Actions #12

Updated by Go MAEDA almost 4 years ago

  • Status changed from Reopened to Closed

Go MAEDA wrote:

The test randomly fails due to r20492.

Committed the fix in r20534.

Actions

Also available in: Atom PDF