renamed tracker 2 type

pull/6827/head
Christian Ratz 11 years ago
parent 316257d3e1
commit 762d3f63cc
  1. 4
      README.rdoc
  2. 30
      app/assets/javascripts/backlogs/model.js
  3. 6
      app/assets/stylesheets/backlogs/master_backlog.css.erb
  4. 2
      app/controllers/rb_application_controller.rb
  5. 66
      app/helpers/rb_common_helper.rb
  6. 6
      app/models/impediment.rb
  7. 20
      app/models/story.rb
  8. 14
      app/models/task.rb
  9. 12
      app/views/rb_stories/_helpers.html.erb
  10. 4
      app/views/rb_stories/_story.html.erb
  11. 24
      app/views/shared/_settings.html.erb
  12. 6
      config/locales/de.yml
  13. 6
      config/locales/en.yml
  14. 18
      features/edit_story.feature
  15. 16
      features/edit_story_tracker_and_status.feature
  16. 4
      features/edit_via_modal.feature
  17. 18
      features/fixed_version_by_issue_hierarchy.feature
  18. 12
      features/issue_hierarchy_restriction_project_boundaries.feature
  19. 16
      features/product_owner.feature
  20. 12
      features/scrum_master.feature
  21. 8
      features/shared_versions.feature
  22. 52
      features/step_definitions/_given_steps.rb
  23. 12
      features/step_definitions/_then_steps.rb
  24. 2
      features/step_definitions/_when_steps.rb
  25. 10
      features/step_definitions/helpers.rb
  26. 6
      features/team_member.feature
  27. 24
      lib/open_project/backlogs/burndown/series_raw_data.rb
  28. 12
      lib/open_project/backlogs/patches/query_patch.rb
  29. 6
      lib/open_project/backlogs/patches/version_patch.rb
  30. 12
      lib/open_project/backlogs/patches/work_package_patch.rb
  31. 4
      lib/open_project/backlogs/work_package_view/issue_hierarchy_paragraph.rb
  32. 6
      lib/tasks/import_config.yaml
  33. 44
      lib/tasks/install.rake
  34. 2
      spec/factories/impediment_factory.rb
  35. 2
      spec/factories/story_factory.rb
  36. 2
      spec/factories/task_factory.rb
  37. 8
      spec/models/backlog_spec.rb
  38. 24
      spec/models/burndown_spec.rb
  39. 24
      spec/models/impediment_spec.rb
  40. 32
      spec/models/issue_fixed_version_propagated_down_spec.rb
  41. 24
      spec/models/issue_fixed_version_restricted_spec.rb
  42. 26
      spec/models/issue_hierarchy_restriction_project_boundaries_spec.rb
  43. 48
      spec/models/issue_position_spec.rb
  44. 2
      spec/models/issue_spec.rb
  45. 18
      spec/models/story_spec.rb
  46. 40
      spec/models/version_spec.rb
  47. 28
      spec/models/work_package_spec.rb
  48. 20
      spec/views/rb_taskboards/show_spec.rb

@ -25,7 +25,7 @@ This plugin aims to be compatible with
* ChiliProject 2.1 and later
If you are running into compatibility issues, please report a bug in the
project's issue tracker.
project's issue type.
*Note:* ChiliProject Backlogs currently needs a core patch, to run on
@ -86,7 +86,7 @@ You should be able to execute the tests with
rake redmine:cucumber:backlogs RAILS_ENV=test
If these instructions are insufficient, please open a ticket in the GitHub issue
tracker with information, where you are stuck.
type with information, where you are stuck.
== Credits

@ -116,7 +116,7 @@ RB.Model = (function ($) {
this.$.find('.editable').each(function (index) {
var field, fieldType, fieldLabel, fieldName, fieldOrder, input, newInput,
trackerId, statusId ;
typeId, statusId ;
field = $(this);
fieldName = field.attr('fieldname');
@ -130,25 +130,25 @@ RB.Model = (function ($) {
$("<label></label>").text(fieldLabel).appendTo(editor);
if (fieldType === 'select') {
// Special handling for status_id => they are dependent of tracker_id
// Special handling for status_id => they are dependent of type_id
if (fieldName === 'status_id') {
trackerId = $.trim(self.$.find('.tracker_id .v').html());
typeId = $.trim(self.$.find('.type_id .v').html());
// when creating stories we need to query the select directly
if (trackerId == '') {
trackerId = $('#tracker_id_options').val();
if (typeId == '') {
typeId = $('#type_id_options').val();
}
statusId = $.trim(self.$.find('.status_id .v').html());
input = self.findFactory(trackerId, statusId, fieldName);
input = self.findFactory(typeId, statusId, fieldName);
}
else if (fieldName === 'tracker_id'){
else if (fieldName === 'type_id'){
input = $('#' + fieldName + '_options').clone(true);
// if the tracker changes the status dropdown has to be modified
// if the type changes the status dropdown has to be modified
input.change(function(){
trackerId = $(this).val();
typeId = $(this).val();
statusId = $.trim(self.$.find('.status_id .v').html());
newInput = self.findFactory(trackerId, statusId, 'status_id');
newInput = self.findFactory(typeId, statusId, 'status_id');
newInput = self.prepareInputFromFactory(newInput,'status_id',fieldOrder,maxTabIndex);
newInput = self.replaceStatusForNewTracker(input, newInput, $(this).parent().find('.status_id').val(), editor);
newInput = self.replaceStatusForNewType(input, newInput, $(this).parent().find('.status_id').val(), editor);
});
}
else {
@ -214,9 +214,9 @@ RB.Model = (function ($) {
return editor;
},
findFactory: function (trackerId, statusId, fieldName){
findFactory: function (typeId, statusId, fieldName){
// Find a factory
newInput = $('#' + fieldName + '_options_' + trackerId + '_' + statusId);
newInput = $('#' + fieldName + '_options_' + typeId + '_' + statusId);
if (newInput.length === 0) {
// when no list found, only offer the default status
// no list = combination is not valid / user has no rights -> workflow
@ -237,7 +237,7 @@ RB.Model = (function ($) {
return input;
},
replaceStatusForNewTracker: function (input,newInput, statusId, editor) {
replaceStatusForNewType: function (input,newInput, statusId, editor) {
// Append an empty field and select it in case the old status is not available
newInput.val(statusId); // try to set the status
if (newInput.val() !== statusId){
@ -399,7 +399,7 @@ RB.Model = (function ($) {
editor = $(this);
fieldName = editor.attr('name');
if (this.type.match(/select/)) {
// if the user changes the tracker and that tracker does not offer the status
// if the user changes the type and that type does not offer the status
// of the current story, the status field is set to blank
// if the user saves this edit we will receive a validation error
// the following 3 lines will prevent the override of the status id

@ -199,7 +199,7 @@ without cutting it even if the bottom backlog does not contain any elements*/
text-align: right;
white-space: nowrap;
}
#rb #backlogs_container .stories .story .tracker_id .t {
#rb #backlogs_container .stories .story .type_id .t {
float: left;
padding: 5px 2px 4px 2px;
text-align: right;
@ -227,7 +227,7 @@ without cutting it even if the bottom backlog does not contain any elements*/
text-align:right;
}
#rb #backlogs_container .stories .story .tracker_id .v,
#rb #backlogs_container .stories .story .type_id .v,
#rb #backlogs_container .stories .story .id .v,
#rb #backlogs_container .stories .story .status_id .v,
#rb #backlogs_container .stories .story .fixed_version_id,
@ -300,7 +300,7 @@ without cutting it even if the bottom backlog does not contain any elements*/
margin: 5px 3px 4px 2px;
padding: 0;
}
#rb #backlogs_container .stories .story.editing .tracker_id.editor {
#rb #backlogs_container .stories .story.editing .type_id.editor {
width: expression( document.body.clientWidth > 99 ? "100px" : "auto" ); /* sets max-width for IE */
max-width:100px; /* for the cool guys */
}

@ -21,7 +21,7 @@ class RbApplicationController < ApplicationController
def check_if_plugin_is_configured
settings = Setting.plugin_openproject_backlogs
if settings["story_trackers"].blank? || settings["task_tracker"].blank?
if settings["story_types"].blank? || settings["task_type"].blank?
respond_to do |format|
format.html { render :file => "shared/not_configured" }
end

@ -94,12 +94,12 @@ module RbCommonHelper
story.new_record? ? "" : h(story.description).gsub(/&lt;(\/?pre)&gt;/, '<\1>')
end
def tracker_id_or_empty(story)
story.new_record? ? "" : story.tracker_id
def type_id_or_empty(story)
story.new_record? ? "" : story.type_id
end
def tracker_name_or_empty(story)
story.new_record? ? "" : h(backlogs_trackers_by_id[story.tracker_id].name)
def type_name_or_empty(story)
story.new_record? ? "" : h(backlogs_types_by_id[story.type_id].name)
end
def updated_on_with_milliseconds(story)
@ -116,18 +116,18 @@ module RbCommonHelper
item.remaining_hours.blank? || item.remaining_hours==0 ? "" : item.remaining_hours
end
def available_story_trackers
@available_story_trackers ||= begin
trackers = story_trackers & @project.trackers if @project
def available_story_types
@available_story_types ||= begin
types = story_types & @project.types if @project
trackers
types
end
end
def available_statuses_by_tracker
@available_statuses_by_tracker ||= begin
available_statuses_by_tracker = Hash.new do |tracker_hash, tracker|
tracker_hash[tracker] = Hash.new do |status_hash, status|
def available_statuses_by_type
@available_statuses_by_type ||= begin
available_statuses_by_type = Hash.new do |type_hash, type|
type_hash[type] = Hash.new do |status_hash, status|
status_hash[status] = [status]
end
end
@ -135,12 +135,12 @@ module RbCommonHelper
workflows = all_workflows
workflows.each do |w|
tracker_status = available_statuses_by_tracker[story_trackers_by_id[w.tracker_id]][w.old_status]
type_status = available_statuses_by_type[story_types_by_id[w.type_id]][w.old_status]
tracker_status << w.new_status unless tracker_status.include?(w.new_status)
type_status << w.new_status unless type_status.include?(w.new_status)
end
available_statuses_by_tracker
available_statuses_by_type
end
end
@ -184,45 +184,45 @@ module RbCommonHelper
def all_workflows
@all_workflows ||= Workflow.all(:include => [:new_status, :old_status],
:conditions => { :role_id => User.current.roles_for_project(@project).collect(&:id),
:tracker_id => story_trackers.collect(&:id) })
:type_id => story_types.collect(&:id) })
end
def all_work_package_status
@all_work_package_status ||= IssueStatus.all(:order => 'position ASC')
end
def backlogs_trackers
@backlogs_trackers ||= begin
backlogs_ids = Setting.plugin_openproject_backlogs["story_trackers"]
backlogs_ids << Setting.plugin_openproject_backlogs["task_tracker"]
def backlogs_types
@backlogs_types ||= begin
backlogs_ids = Setting.plugin_openproject_backlogs["story_types"]
backlogs_ids << Setting.plugin_openproject_backlogs["task_type"]
Tracker.find(:all,
Type.find(:all,
:conditions => { :id => backlogs_ids },
:order => 'position ASC')
end
end
def backlogs_trackers_by_id
@backlogs_trackers_by_id ||= begin
backlogs_trackers.inject({}) do |mem, tracker|
mem[tracker.id] = tracker
def backlogs_types_by_id
@backlogs_types_by_id ||= begin
backlogs_types.inject({}) do |mem, type|
mem[type.id] = type
mem
end
end
end
def story_trackers
@story_trackers ||= begin
backlogs_tracker_ids = Setting.plugin_openproject_backlogs["story_trackers"].map(&:to_i)
def story_types
@story_types ||= begin
backlogs_type_ids = Setting.plugin_openproject_backlogs["story_types"].map(&:to_i)
backlogs_trackers.select{ |t| backlogs_tracker_ids.include?(t.id) }
backlogs_types.select{ |t| backlogs_type_ids.include?(t.id) }
end
end
def story_trackers_by_id
@story_trackers_by_id ||= begin
story_trackers.inject({}) do |mem, tracker|
mem[tracker.id] = tracker
def story_types_by_id
@story_types_by_id ||= begin
story_types.inject({}) do |mem, type|
mem[type.id] = type
mem
end
end

@ -17,12 +17,12 @@ class Impediment < Task
if args[1] && args[1][:conditions]
if args[1][:conditions].is_a?(Hash)
args[1][:conditions][:parent_id] = nil
args[1][:conditions][:tracker_id] = self.tracker
args[1][:conditions][:type_id] = self.type
elsif args[1][:conditions].is_a?(Array)
args[1][:conditions][0] += " AND parent_id is NULL AND tracker_id = #{self.tracker}"
args[1][:conditions][0] += " AND parent_id is NULL AND type_id = #{self.type}"
end
else
args << {:conditions => {:parent_id => nil, :tracker_id => self.tracker}}
args << {:conditions => {:parent_id => nil, :type_id => self.type}}
end
super

@ -51,11 +51,11 @@ class Story < WorkPackage
:offset => rank - 1)
end
def self.trackers
trackers = Setting.plugin_openproject_backlogs["story_trackers"]
return [] if trackers.blank?
def self.types
types = Setting.plugin_openproject_backlogs["story_types"]
return [] if types.blank?
trackers.map { |tracker| Integer(tracker) }
types.map { |type| Integer(type) }
end
def tasks
@ -63,13 +63,13 @@ class Story < WorkPackage
end
def tasks_and_subtasks
return [] unless Task.tracker
self.descendants.find_all_by_tracker_id(Task.tracker)
return [] unless Task.type
self.descendants.find_all_by_type_id(Task.type)
end
def direct_tasks_and_subtasks
return [] unless Task.tracker
self.children.find_all_by_tracker_id(Task.tracker).collect { |t| [t] + t.descendants }.flatten
return [] unless Task.type
self.children.find_all_by_type_id(Task.type).collect { |t| [t] + t.descendants }.flatten
end
def set_points(p)
@ -143,8 +143,8 @@ class Story < WorkPackage
private
def self.condition(project_id, sprint_ids, extras = [])
c = ["project_id = ? AND tracker_id in (?) AND fixed_version_id in (?)",
project_id, Story.trackers, sprint_ids]
c = ["project_id = ? AND type_id in (?) AND fixed_version_id in (?)",
project_id, Story.types, sprint_ids]
if extras.size > 0
c[0] += ' ' + extras.shift

@ -5,15 +5,15 @@ class Task < WorkPackage
extend OpenProject::Backlogs::Mixins::PreventIssueSti
def self.tracker
task_tracker = Setting.plugin_openproject_backlogs["task_tracker"]
task_tracker.blank? ? nil : task_tracker.to_i
def self.type
task_type = Setting.plugin_openproject_backlogs["task_type"]
task_type.blank? ? nil : task_type.to_i
end
# This method is used by Backlogs::List.
# It ensures, that tasks and stories follow a similar interface
def self.trackers
[self.tracker]
def self.types
[self.type]
end
def self.create_with_relationships(params, project_id)
@ -21,7 +21,7 @@ class Task < WorkPackage
task.author = User.current
task.project_id = project_id
task.tracker_id = Task.tracker
task.type_id = Task.type
task.safe_attributes = params
@ -66,7 +66,7 @@ class Task < WorkPackage
end
def rank
@rank ||= WorkPackage.count(:conditions => ['tracker_id = ? and not parent_id is NULL and root_id = ? and lft <= ?', Task.tracker, story_id, self.lft])
@rank ||= WorkPackage.count(:conditions => ['type_id = ? and not parent_id is NULL and root_id = ? and lft <= ?', Task.type, story_id, self.lft])
return @rank
end
end

@ -1,7 +1,7 @@
<!-- story helper tags -->
<% available_statuses_by_tracker.each do |tracker, issue_statuses| %>
<% available_statuses_by_type.each do |type, issue_statuses| %>
<% issue_statuses.each do |old_status, allowed_issue_statuses| %>
<select class="status_id helper" id="status_id_options_<%= tracker.id %>_<%= old_status.id %>">
<select class="status_id helper" id="status_id_options_<%= type.id %>_<%= old_status.id %>">
<% allowed_issue_statuses.sort_by(&:position).each do |status| %>
<option value="<%= status.id %>" class="<%= (status.is_closed? ? l(:label_closed_issues) + ' ' : "") %>">
<%= status.name %>
@ -32,10 +32,10 @@
<% end %>
</select>
<select class="tracker_id helper" id="tracker_id_options">
<% available_story_trackers.each do |tracker| %>
<option value="<%= tracker.id %>">
<%= tracker.name %>
<select class="type_id helper" id="type_id_options">
<% available_story_types.each do |type| %>
<option value="<%= type.id %>">
<%= type.name %>
</option>
<% end %>
</select>

@ -9,8 +9,8 @@
<div class="v"><%= status_id_or_default(story) %></div>
</div>
<div class="tracker_id editable" fieldtype="select" fieldname="tracker_id" fieldorder="1">
<div class="t"><%= tracker_name_or_empty(story) %>: </div>
<div class="v"><%= tracker_id_or_empty(story) %></div>
<div class="t"><%= type_name_or_empty(story) %>: </div>
<div class="v"><%= type_id_or_empty(story) %></div>
</div>
<div class="subject editable ellipsis" fieldname="subject" fieldorder="2" title="<%= h story.subject %>"><%=h story.subject %></div>
<div class="fixed_version_id"><%= story.fixed_version_id %></div>

@ -2,17 +2,17 @@
<script type="text/javascript">
jQuery(function($) {
var enable_apply = function () {
var tasktracker,
var tasktype,
submit,
disable;
tasktracker = $("#settings_task_tracker").val();
tasktype = $("#settings_task_type").val();
submit = $('input[type=submit]');
disable = false;
$("#settings_story_trackers :selected").each(function(i, selected) {
disable = disable || ($(selected).attr('value') === tasktracker);
$("#settings_story_types :selected").each(function(i, selected) {
disable = disable || ($(selected).attr('value') === tasktype);
});
if (disable) {
@ -23,8 +23,8 @@
}
};
$("#settings_task_tracker").change(enable_apply);
$("#settings_story_trackers").change(enable_apply);
$("#settings_task_type").change(enable_apply);
$("#settings_story_types").change(enable_apply);
enable_apply();
});
@ -32,14 +32,14 @@
<% end %>
<p>
<%= label_tag("settings[story_trackers]", l(:backlogs_story_tracker)) %>
<%= select_tag("settings[story_trackers]",
options_from_collection_for_select(Tracker.all, :id, :name, Story.trackers), :multiple => true) %>
<%= label_tag("settings[story_types]", l(:backlogs_story_type)) %>
<%= select_tag("settings[story_types]",
options_from_collection_for_select(Tracker.all, :id, :name, Story.types), :multiple => true) %>
</p>
<p>
<%= label_tag("settings[task_tracker]", l(:backlogs_task_tracker)) %>
<%= select_tag("settings[task_tracker]",
options_from_collection_for_select(Tracker.all, :id, :name, Task.tracker)) %>
<%= label_tag("settings[task_type]", l(:backlogs_task_type)) %>
<%= select_tag("settings[task_type]",
options_from_collection_for_select(Type.all, :id, :name, Task.type)) %>
</p>
<p>
<%= label_tag("settings[points_burn_direction]", l(:backlogs_points_burn_direction)) %>

@ -19,7 +19,7 @@ de:
task_version_must_be_the_same_as_story_version: "muss der Version der Story entsprechen"
parent_issue_id:
parent_child_relationship_across_projects: "ist ungültig da '%{issue_name}' ein backlogs Task und das gewünschte Eltern-Ticket '%{parent_name}' ein Backlogs-Element in einem anderen Projekt ist"
tracker_must_be_one_of_the_following: "muss aus einem der folgenden Trackern sein: %{tracker_names}"
tracker_must_be_one_of_the_following: "muss aus einem der folgenden Typen sein: %{tracker_names}"
sprint:
cannot_end_before_it_starts: "Sprint kann nicht enden, bevor er begonnen hat"
@ -68,9 +68,9 @@ de:
backlogs_sprint_unsized: "Das Projekt hat Stories auf aktiven oder vor kurzem geschlossenen Sprints welche keine Aufwandsangaben enthalten"
backlogs_sprints: "Sprints"
backlogs_story: "Story"
backlogs_story_tracker: "Story Tracker"
backlogs_story_type: "Story Type"
backlogs_task: "Aufgabe"
backlogs_task_tracker: "Aufgaben Tracker"
backlogs_task_type: "Aufgaben Type"
backlogs_velocity_missing: "Es konnte keine Geschwindigkeit für dieses Projekt berechnet werden"
backlogs_velocity_varies: "Die Geschwindigkeit variiert stark zwischen den Sprints"
backlogs_wiki_template: "Vorlage für das Sprint-Wiki"

@ -19,7 +19,7 @@ en:
task_version_must_be_the_same_as_story_version: "must be the same as the story's version"
parent_issue_id:
parent_child_relationship_across_projects: "is invalid because the issue '%{issue_name}' is a backlogs task and as such can not have the backlogs story '%{parent_name}' as it´s parent as long as the story is in a different project"
tracker_must_be_one_of_the_following: "Tracker must be one of the following: %{tracker_names}"
type_must_be_one_of_the_following: "Tracker must be one of the following: %{type_names}"
sprint:
cannot_end_before_it_starts: "Sprint cannot end before it starts"
@ -68,9 +68,9 @@ en:
backlogs_sprint_unsized: "Project has stories on active or recently closed sprints that were not sized"
backlogs_sprints: "Sprints"
backlogs_story: "Story"
backlogs_story_tracker: "Story trackers"
backlogs_story_type: "Story types"
backlogs_task: "Task"
backlogs_task_tracker: "Task tracker"
backlogs_task_type: "Task type"
backlogs_velocity_missing: "No velocity could be calculated for this project"
backlogs_velocity_varies: "Velocity varies significantly over sprints"
backlogs_wiki_template: "Template for sprint wiki page"

@ -9,12 +9,12 @@ Feature: Edit story on backlogs view
And I am working in project "ecookbook"
And the project uses the following modules:
| backlogs |
And the following trackers are configured to track stories:
And the following types are configured to track stories:
| Story |
| Epic |
| Bug |
And the tracker "Task" is configured to track tasks
And the project uses the following trackers:
And the type "Task" is configured to track tasks
And the project uses the following types:
| Story |
| Bug |
| Task |
@ -45,7 +45,7 @@ Feature: Edit story on backlogs view
| Resolved | false | false |
| Closed | true | false |
| Rejected | true | false |
And the tracker "Story" has the default workflow for the role "team member"
And the type "Story" has the default workflow for the role "team member"
And there is a default issuepriority with:
| name | Normal |
And the project has the following stories in the following owner backlogs:
@ -107,21 +107,21 @@ Feature: Edit story on backlogs view
And the velocity of "Sprint 001" should be "31"
@javascript
Scenario: Setting trackers of a story
Scenario: Setting types of a story
Given I am on the master backlog
When I open the "Sprint 001" menu
And I follow "New Story" of the "Sprint 001" menu
And I close the "Sprint 001" menu
And I fill in "The Wizard of Oz" for "subject"
And I select "Bug" from "tracker_id"
And I select "Bug" from "type_id"
And I confirm the story form
Then the 1st story in "Sprint 001" should be "The Wizard of Oz"
And the 1st story in "Sprint 001" should be in the "Bug" tracker
And the 1st story in "Sprint 001" should be in the "Bug" type
@javascript
Scenario: Hiding trackers, that are not active in the project
Scenario: Hiding types, that are not active in the project
Given I am on the master backlog
When I open the "Sprint 001" menu
And I follow "New Story" of the "Sprint 001" menu
And I close the "Sprint 001" menu
Then I should not see "Epic" within_hidden ".tracker_id.helper"
Then I should not see "Epic" within_hidden ".type_id.helper"

@ -1,6 +1,6 @@
Feature: Edit story tracker and status
Feature: Edit story type and status
As a user
I want to edit the tracker and the status of a story
I want to edit the type and the status of a story
In consideration of existing workflows
So that I can not make changes that are not permitted by the system
@ -10,12 +10,12 @@ Feature: Edit story tracker and status
And I am working in project "ecookbook"
And the project uses the following modules:
| backlogs |
And the following trackers are configured to track stories:
And the following types are configured to track stories:
| Story |
| Epic |
| Bug |
And the tracker "Task" is configured to track tasks
And the project uses the following trackers:
And the type "Task" is configured to track tasks
And the project uses the following types:
| Story |
| Bug |
| Task |
@ -42,7 +42,7 @@ Feature: Edit story tracker and status
And there is a default issuepriority with:
| name | Normal |
And the project has the following stories in the following sprints:
| subject | sprint | tracker | story_points |
| subject | sprint | type | story_points |
| Story A | Sprint 001 | Bug | 10 |
| Story B | Sprint 001 | Story | 20 |
| Story C | Sprint 001 | Bug | 20 |
@ -78,7 +78,7 @@ Feature: Edit story tracker and status
| Closed |
@javascript
Scenario: Select a status and change to a tracker that does not offer the status
Scenario: Select a status and change to a type that does not offer the status
When I click on the text "Story B"
Then the available status of the story called "Story B" should be the following:
@ -86,7 +86,7 @@ Feature: Edit story tracker and status
| Rejected |
When I select "Rejected" from "status_id"
And I select "Bug" from "tracker_id"
And I select "Bug" from "type_id"
Then the editable attributes of the story called "Story B" should be the following:
| Status | |

@ -24,14 +24,14 @@ Feature: Edit issue via modal box
And the following trackers are configured to track stories:
| Story |
And the tracker "Task" is configured to track tasks
And the project uses the following trackers:
And the project uses the following types:
| Story |
| Task |
And there is a default issuestatus with:
| name | new |
And there is a default issuepriority with:
| name | Normal |
And the tracker "Task" has the default workflow for the role "scrum master"
And the type "Task" has the default workflow for the role "scrum master"
And there is 1 user with:
| login | markus |
| firstname | Markus |

@ -37,15 +37,15 @@ Feature: The issue hierarchy defines the allowed versions for each issue depende
And there is a default issuepriority with:
| name | Normal |
And the backlogs module is initialized
And the following trackers are configured to track stories:
And the following types are configured to track stories:
| Story |
And the tracker "Task" is configured to track tasks
And the project uses the following trackers:
And the type "Task" is configured to track tasks
And the project uses the following types:
| Story |
| Epic |
| Task |
| Bug |
And the tracker "Task" has the default workflow for the role "scrum master"
And the type "Task" has the default workflow for the role "scrum master"
And there is 1 user with:
| login | markus |
| firstname | Markus |
@ -106,14 +106,14 @@ Feature: The issue hierarchy defines the allowed versions for each issue depende
Scenario: Creating a task, via subtask, as a subtask to a story sets the new task's fixed version to the parent's fixed version
When I go to the page of the issue "Story A"
And I follow the link to add a subtask
And I select "Task" from "work_package_tracker_id"
And I select "Task" from "work_package_type_id"
And I fill in "Task 0815" for "work_package_subject"
And I click on the first button matching "Create"
Then I should see "Sprint 001" within "td.fixed-version"
Scenario: Creating a task, via new work_package, as a subtask to a story set´s the new task´s fixed version to the parent´s fixed version
When I go to the new work_package page of the project called "ecookbook"
And I select "Task" from "work_package_tracker_id"
And I select "Task" from "work_package_type_id"
And I fill in "Task 0815" for "work_package_subject"
And I fill in the id of the issue "Story A" as the parent issue
And I click on the first button matching "Create"
@ -121,7 +121,7 @@ Feature: The issue hierarchy defines the allowed versions for each issue depende
Scenario: Creating a task, via new work_package, as a subtask to a story and setting a fixed version is overriden by the parent´s fixed version (bug 8904)
When I go to the new work_package page of the project called "ecookbook"
And I select "Task" from "work_package_tracker_id"
And I select "Task" from "work_package_type_id"
And I fill in "Task 0815" for "work_package_subject"
And I fill in the id of the issue "Story A" as the parent issue
And I select "Sprint 003" from "work_package_fixed_version_id"
@ -139,7 +139,7 @@ Feature: The issue hierarchy defines the allowed versions for each issue depende
Scenario: Changing the fixed_version of a task with a non backlogs parent issue (bug 8354)
Given the project has the following issues:
| subject | sprint | tracker |
| subject | sprint | type |
| Epic 1 | Sprint 001 | Epic |
And the project has the following tasks:
| subject | parent |
@ -151,7 +151,7 @@ Feature: The issue hierarchy defines the allowed versions for each issue depende
Scenario: Changing the fixed_version of an epic should not change the target version of the child (bug 8903)
Given the project has the following issues:
| subject | sprint | tracker | parent |
| subject | sprint | type | parent |
| Epic 1 | Sprint 001 | Epic | |
| Task 1 | Sprint 002 | Task | Epic 1 |
When I go to the edit page of the issue "Epic 1"

@ -28,15 +28,15 @@ Feature: The issue hierarchy between backlogs stories and backlogs tasks can not
| add_issues |
| add_work_packages |
And the backlogs module is initialized
And the following trackers are configured to track stories:
And the following types are configured to track stories:
| Story |
And the tracker "Task" is configured to track tasks
And the project uses the following trackers:
And the type "Task" is configured to track tasks
And the project uses the following types:
| Story |
| Epic |
| Task |
| Bug |
And the tracker "Task" has the default workflow for the role "scrum master"
And the type "Task" has the default workflow for the role "scrum master"
And there are the following issue status:
| name | is_closed | is_default |
| New | false | true |
@ -62,10 +62,10 @@ Feature: The issue hierarchy between backlogs stories and backlogs tasks can not
@javascript
Scenario: Adding a task in the child project as a child to the story is inhibited
Given the project "parent_project" has the following issues:
| subject | tracker |
| subject | type |
| Story A | Story |
When I go to the issues/new page of the project called "child_project"
And I select "Task" from "issue_tracker_id"
And I select "Task" from "issue_type_id"
And I fill in "Task 0815" for "issue_subject"
And I fill in the id of the issue "Story A" as the parent issue
And I click on the first button matching "Create"

@ -4,10 +4,10 @@ Feature: Product Owner
So that they get done according to my requirements
Background:
Given the following trackers are configured to track stories:
Given the following types are configured to track stories:
| Story |
| Epic |
And the tracker "Task" is configured to track tasks
And the type "Task" is configured to track tasks
And there are the following issue status:
| name | is_closed | is_default |
| New | false | true |
@ -22,9 +22,9 @@ Feature: Product Owner
| edit_work_packages |
| manage_subtasks |
And the tracker "Story" has the default workflow for the role "product owner"
And the tracker "Epic" has the default workflow for the role "product owner"
And the tracker "Task" has the default workflow for the role "product owner"
And the type "Story" has the default workflow for the role "product owner"
And the type "Epic" has the default workflow for the role "product owner"
And the type "Task" has the default workflow for the role "product owner"
And there is 1 project with:
| name | ecookbook |
@ -33,7 +33,7 @@ Feature: Product Owner
| name | Normal |
And the project uses the following modules:
| backlogs |
And the project uses the following trackers:
And the project uses the following types:
| Story |
| Epic |
| Task |
@ -83,10 +83,10 @@ Feature: Product Owner
Given I am on the master backlog
And I want to edit the story with subject Story 3
And I set the subject of the story to Relaxdiego was here
And I set the tracker of the story to Epic
And I set the type of the story to Epic
When I update the story
Then the story should have a subject of Relaxdiego was here
And the story should have a tracker of Epic
And the story should have a type of Epic
And the story should be at position 3
Scenario: Close a story

@ -24,10 +24,10 @@ Feature: Scrum Master
| edit_work_packages |
| manage_subtasks |
And the backlogs module is initialized
And the following trackers are configured to track stories:
And the following types are configured to track stories:
| Story |
And the tracker "Task" is configured to track tasks
And the project uses the following trackers:
And the type "Task" is configured to track tasks
And the project uses the following types:
| Story |
| Epic |
| Task |
@ -41,7 +41,7 @@ Feature: Scrum Master
| Rejected | true | false |
And there is a default issuepriority with:
| name | Normal |
And the tracker "Task" has the default workflow for the role "scrum master"
And the type "Task" has the default workflow for the role "scrum master"
And there is 1 user with:
| login | markus |
| firstname | Markus |
@ -75,7 +75,7 @@ Feature: Scrum Master
| subject | sprint | blocks |
| Impediment 1 | Sprint 001 | Story A |
And the project has the following issues:
| subject | sprint | tracker |
| subject | sprint | type |
| Epic 1 | Sprint 005 | Epic |
And the project has the following stories in the following sprints:
| subject | sprint | parent |
@ -89,7 +89,7 @@ Feature: Scrum Master
| Subtask 2 | Sprint 005 | Task 10 |
| Subtask 3 | Sprint 005 | Task 11 |
And the project has the following issues:
| subject | sprint | parent | tracker |
| subject | sprint | parent | type |
| Subfeature | Sprint 005 | Task 10 | Bug |
| Subsubtask | Sprint 005 | Subfeature | Task |
And I am already logged in as "markus"

@ -13,14 +13,14 @@ Feature: Shared Versions
| name | child |
And the project "child" uses the following modules:
| backlogs |
And the following trackers are configured to track stories:
And the following types are configured to track stories:
| story |
| epic |
And the tracker "task" is configured to track tasks
And the project "parent" uses the following trackers:
And the type "task" is configured to track tasks
And the project "parent" uses the following types:
| story |
| task |
And the project "child" uses the following trackers:
And the project "child" uses the following types:
| story |
| task |
And I am working in project "child"

@ -3,9 +3,9 @@ Given /^I am logged out$/ do
end
Given /^I set the (.+) of the story to (.+)$/ do |attribute, value|
if attribute == "tracker"
attribute = "tracker_id"
value = Tracker.find(:first, :conditions => ["name=?", value]).id
if attribute == "type"
attribute = "type_id"
value = Type.find(:first, :conditions => ["name=?", value]).id
elsif attribute == "status"
attribute = "status_id"
value = IssueStatus.find(:first, :conditions => ["name=?", value]).id
@ -81,9 +81,9 @@ end
Given /^the backlogs module is initialized(?: in [pP]roject "(.*)")?$/ do |project_name|
project = get_project(project_name)
step 'the following trackers are configured to track stories:', Cucumber::Ast::Table.new([['Story'], ['Epic']])
step 'the tracker "Task" is configured to track tasks'
step "the project \"#{project.name}\" uses the following trackers:", Cucumber::Ast::Table.new([['Story', 'Task']])
step 'the following types are configured to track stories:', Cucumber::Ast::Table.new([['Story'], ['Epic']])
step 'the type "Task" is configured to track tasks'
step "the project \"#{project.name}\" uses the following types:", Cucumber::Ast::Table.new([['Story', 'Task']])
end
Given /^the [pP]roject(?: "([^\"]*)")? has the following sprints:$/ do |project_name, table|
@ -139,7 +139,7 @@ Given /^the [pP]roject(?: "([^\"]*)")? has the following stories in the followin
params['fixed_version_id'] = Version.find_by_name(story['sprint'] || story['backlog']).id
params['story_points'] = story['story_points']
params['status_id'] = IssueStatus.find_by_name(story['status']).id if story['status']
params['tracker_id'] = Tracker.find_by_name(story['tracker']).id if story['tracker']
params['type_id'] = Type.find_by_name(story['type']).id if story['type']
params.delete "position"
# NOTE: We're bypassing the controller here because we're just
@ -177,8 +177,8 @@ Given /^the [pP]roject(?: "([^\"]*)")? has the following issues:$/ do |project_n
as_admin do
table.hashes.each do |task|
parent = Issue.find(:first, :conditions => { :subject => task['parent'] })
tracker = Tracker.find_by_name(task['tracker'])
params = initialize_issue_params(project, tracker, parent)
type = Type.find_by_name(task['type'])
params = initialize_issue_params(project, type, parent)
params['subject'] = task['subject']
version = Version.find_by_name(task['sprint'] || task['backlog'])
params['fixed_version_id'] = version.id if version
@ -262,40 +262,40 @@ Given /^there are no stories in the [pP]roject$/ do
@project.work_packages.delete_all
end
Given /^the tracker "(.+?)" is configured to track tasks$/ do |tracker_name|
tracker = Tracker.find_by_name(tracker_name)
tracker = FactoryGirl.create(:tracker, :name => tracker_name) if tracker.blank?
Given /^the type "(.+?)" is configured to track tasks$/ do |type_name|
type = Type.find_by_name(type_name)
type = FactoryGirl.create(:type, :name => type_name) if type.blank?
Setting.plugin_openproject_backlogs = Setting.plugin_openproject_backlogs.merge("task_tracker" => tracker.id)
Setting.plugin_openproject_backlogs = Setting.plugin_openproject_backlogs.merge("task_type" => type.id)
end
Given /^the following trackers are configured to track stories:$/ do |table|
story_trackers = []
Given /^the following types are configured to track stories:$/ do |table|
story_types = []
table.raw.each do |line|
name = line.first
tracker = Tracker.find_by_name(name)
type = Type.find_by_name(name)
tracker = FactoryGirl.create(:tracker, :name => name) if tracker.blank?
story_trackers << tracker
type = FactoryGirl.create(:type, :name => name) if type.blank?
story_types << type
end
# otherwise the tracker id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_trackers, nil)
# otherwise the type id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_types, nil)
Setting.plugin_openproject_backlogs = Setting.plugin_openproject_backlogs.merge("story_trackers" => story_trackers.map(&:id))
Setting.plugin_openproject_backlogs = Setting.plugin_openproject_backlogs.merge("story_types" => story_types.map(&:id))
end
Given /^the [tT]racker(?: "([^\"]*)")? has for the Role "(.+?)" the following workflows:$/ do |tracker_name, role_name, table|
Given /^the [tT]racker(?: "([^\"]*)")? has for the Role "(.+?)" the following workflows:$/ do |type_name, role_name, table|
role = Role.find_by_name(role_name)
tracker = Tracker.find_by_name(tracker_name)
type = Type.find_by_name(type_name)
tracker.workflows = []
type.workflows = []
table.hashes.each do |workflow|
old_status = IssueStatus.find_by_name(workflow['old_status']).id
new_status = IssueStatus.find_by_name(workflow['new_status']).id
tracker.workflows.build(:old_status_id => old_status , :new_status_id => new_status , :role => role)
type.workflows.build(:old_status_id => old_status , :new_status_id => new_status , :role => role)
end
tracker.save!
type.save!
end
Given /^the status of "([^"]*)" is "([^"]*)"$/ do |issue_subject, status_name|

@ -99,12 +99,12 @@ Then /^the (\d+)(?:st|nd|rd|th) story in (?:the )?"(.+?)" should be "(.+)"$/ do
story.subject.should == subject
end
Then /^the (\d+)(?:st|nd|rd|th) story in (?:the )?"(.+?)" should be in the "(.+?)" tracker$/ do |position, version_name, tracker_name|
Then /^the (\d+)(?:st|nd|rd|th) story in (?:the )?"(.+?)" should be in the "(.+?)" type$/ do |position, version_name, type_name|
version = Version.find_by_name(version_name)
tracker = Tracker.find_by_name(tracker_name)
type = Type.find_by_name(type_name)
story = Story.at_rank(@project.id, version.id, position.to_i)
story.should_not be_nil
story.tracker.should == tracker
story.type.should == type
end
Then /^the (\d+)(?:st|nd|rd|th) story in (?:the )?"(.+?)" should have the ID of "(.+?)"$/ do |position, version_name, subject|
@ -190,9 +190,9 @@ end
Then /^the story should have a (.+) of (.+)$/ do |attribute, value|
@story.reload
if attribute=="tracker"
attribute="tracker_id"
value = Tracker.find(:first, :conditions => ["name=?", value]).id
if attribute=="type"
attribute="type_id"
value = Type.find(:first, :conditions => ["name=?", value]).id
end
@story[attribute].should == value
end

@ -37,7 +37,7 @@ When /^I move the story named (.+) (up|down) to the (\d+)(?:st|nd|rd|th) positio
attributes[:prev] = if position == 1
''
else
stories = Story.find(:all, :conditions => ["fixed_version_id=? AND tracker_id IN (?)", sprint.id, Story.trackers], :order => "position ASC")
stories = Story.find(:all, :conditions => ["fixed_version_id=? AND type_id IN (?)", sprint.id, Story.types], :order => "position ASC")
raise "You indicated an invalid position (#{position}) in a sprint with #{stories.length} stories" if 0 > position or position > stories.length
stories[position - (direction=="up" ? 2 : 1)].id
end

@ -1,6 +1,6 @@
def initialize_story_params(project, user = User.find(:first))
story = HashWithIndifferentAccess.new(Story.new.attributes)
story['tracker_id'] = Story.trackers.first
story['type_id'] = Story.types.first
# unsafe attributes that will not be used directly but added for your
# convenience
@ -13,7 +13,7 @@ end
def initialize_task_params(project, story, user = User.find(:first))
params = HashWithIndifferentAccess.new
params['tracker_id'] = Task.tracker
params['type_id'] = Task.type
params['parent_issue_id'] = story.id if story
params['status_id'] = IssueStatus.find(:first).id
@ -26,9 +26,9 @@ def initialize_task_params(project, story, user = User.find(:first))
params
end
def initialize_issue_params(project, tracker = Tracker.find(:first), parent = nil, user = User.find(:first))
def initialize_issue_params(project, type = Type.find(:first), parent = nil, user = User.find(:first))
params = HashWithIndifferentAccess.new
params['tracker_id'] = tracker.id
params['type_id'] = type.id
params['parent_issue_id'] = parent.id if parent
params['status_id'] = IssueStatus.find(:first).id
@ -43,7 +43,7 @@ end
def initialize_impediment_params(project, sprint, user = User.find(:first))
params = HashWithIndifferentAccess.new(Task.new.attributes)
params['tracker_id'] = Task.tracker
params['type_id'] = Task.type
params['fixed_version_id'] = sprint.id
params['status_id'] = IssueStatus.find(:first).id

@ -9,11 +9,11 @@ Feature: Team Member
And I am working in project "ecookbook"
And the project uses the following modules:
| backlogs |
And the following trackers are configured to track stories:
And the following types are configured to track stories:
| Story |
| Epic |
And the tracker "Task" is configured to track tasks
And the project uses the following trackers:
And the type "Task" is configured to track tasks
And the project uses the following types:
| Story |
| Task |
And there is a default issuestatus with:

@ -18,7 +18,7 @@ module OpenProject::Backlogs::Burndown
end
def out_names
@out_names ||= ["project_id", "fixed_version_id", "tracker_id", "status_id"]
@out_names ||= ["project_id", "fixed_version_id", "type_id", "status_id"]
end
def unit_for(name)
@ -92,16 +92,16 @@ module OpenProject::Backlogs::Burndown
fixed_version_query = "(#{Issue.table_name}.fixed_version_id = ? OR journals.changed_data LIKE '%fixed_version_id: - ? - [0-9]+%' OR journals.changed_data LIKE '%fixed_version_id: - [0-9]+ - ?%')"
project_id_query = "(#{Issue.table_name}.project_id = ? OR journals.changed_data LIKE '%project_id: - ? - [0-9]+%' OR journals.changed_data LIKE '%project_id: - [0-9]+ - ?%')"
trackers_string = "(#{collected_trackers.map{|i| "(#{i})"}.join("|")})"
tracker_id_query = "(#{Issue.table_name}.tracker_id in (?) OR journals.changed_data LIKE '%tracker_id: - #{trackers_string} - [0-9]+%' OR journals.changed_data LIKE '%tracker_id: - [0-9]+ - #{trackers_string}%')"
types_string = "(#{collected_types.map{|i| "(#{i})"}.join("|")})"
type_id_query = "(#{Issue.table_name}.type_id in (?) OR journals.changed_data LIKE '%type_id: - #{types_string} - [0-9]+%' OR journals.changed_data LIKE '%type_id: - [0-9]+ - #{types_string}%')"
stories = Issue.all(:include => :journals,
:conditions => ["#{ fixed_version_query }" +
" AND #{ project_id_query }" +
" AND #{ tracker_id_query }",
" AND #{ type_id_query }",
sprint.id, sprint.id, sprint.id,
project.id, project.id, project.id,
collected_trackers],
collected_types],
:order => "#{Issue.table_name}.id")
stories.delete_if do |s|
@ -115,8 +115,8 @@ module OpenProject::Backlogs::Burndown
end
stories.delete_if do |s|
!collected_trackers.include?(s.tracker_id) and
s.journals.none? { |j| j.changed_data['tracker_id'] && collected_trackers.map(&:to_s).include?(j.changed_data['tracker_id'].first.to_s) }
!collected_types.include?(s.type_id) and
s.journals.none? { |j| j.changed_data['type_id'] && collected_types.map(&:to_s).include?(j.changed_data['type_id'].first.to_s) }
end
stories
@ -139,7 +139,7 @@ module OpenProject::Backlogs::Burndown
(collect_names.include?(key) &&
not_in_project?(story, date, details_by_prop, current_prop_index) ||
not_in_sprint?(story, date, details_by_prop, current_prop_index) ||
not_in_tracker?(story, date, details_by_prop, current_prop_index)
not_in_type?(story, date, details_by_prop, current_prop_index)
) ||
((key == "story_points") && story_is_closed?(story, date, details_by_prop, current_prop_index)) ||
((key == "story_points") && story_is_done?(story, date, details_by_prop, current_prop_index)) ||
@ -156,8 +156,8 @@ module OpenProject::Backlogs::Burndown
sprint.id != value_for_prop(date, details_by_prop["fixed_version_id"], current_prop_index["fixed_version_id"], story.send("fixed_version_id")).to_i
end
def not_in_tracker?(story, date, details_by_prop, current_prop_index)
!collected_trackers.include?(value_for_prop(date, details_by_prop["tracker_id"], current_prop_index["tracker_id"], story.send("tracker_id")).to_i)
def not_in_type?(story, date, details_by_prop, current_prop_index)
!collected_types.include?(value_for_prop(date, details_by_prop["type_id"], current_prop_index["type_id"], story.send("type_id")).to_i)
end
def story_is_closed?(story, date, details_by_prop, current_prop_index)
@ -184,8 +184,8 @@ module OpenProject::Backlogs::Burndown
value
end
def collected_trackers
@collected_trackers ||= Story.trackers << Task.tracker
def collected_types
@collected_types ||= Story.types << Task.type
end
def issue_status_by_id(status_id)

@ -46,15 +46,15 @@ module OpenProject::Backlogs::Patches::QueryPatch
selected_values = values_for(field)
selected_values = ['story', 'task'] if selected_values.include?('any')
story_trackers = Story.trackers.collect { |val| "#{val}" }.join(",")
all_trackers = (Story.trackers + [Task.tracker]).collect { |val| "#{val}" }.join(",")
story_types = Story.types.collect { |val| "#{val}" }.join(",")
all_types = (Story.types + [Task.type]).collect { |val| "#{val}" }.join(",")
selected_values.each do |val|
case val
when "story"
sql << "(#{db_table}.tracker_id IN (#{story_trackers}))"
sql << "(#{db_table}.type_id IN (#{story_types}))"
when "task"
sql << "(#{db_table}.tracker_id = #{Task.tracker} AND NOT #{db_table}.parent_id IS NULL)"
sql << "(#{db_table}.type_id = #{Task.type} AND NOT #{db_table}.parent_id IS NULL)"
when "impediment"
sql << "(#{db_table}.id IN (
select issue_from_id
@ -62,7 +62,7 @@ module OpenProject::Backlogs::Patches::QueryPatch
JOIN issues blocked
ON
blocked.id = ir.issue_to_id
AND blocked.tracker_id IN (#{all_trackers})
AND blocked.type_id IN (#{all_types})
WHERE ir.relation_type = 'blocks'
) AND #{db_table}.parent_id IS NULL)"
end
@ -84,7 +84,7 @@ module OpenProject::Backlogs::Patches::QueryPatch
protected
def backlogs_configured?
Story.trackers.present? and Task.tracker.present?
Story.types.present? and Task.type.present?
end
def backlogs_enabled?

@ -21,13 +21,13 @@ module OpenProject::Backlogs::Patches::VersionPatch
Issue.transaction do
# remove position from all non-stories
Issue.update_all({:position => nil}, ['project_id = ? AND tracker_id NOT IN (?) AND position IS NOT NULL', project, Story.trackers])
Issue.update_all({:position => nil}, ['project_id = ? AND type_id NOT IN (?) AND position IS NOT NULL', project, Story.types])
# add issues w/o position to the top of the list
# and add issues, that have a position, at the end
stories_wo_position = self.fixed_issues.find(:all, :conditions => {:project_id => project, :tracker_id => Story.trackers, :position => nil}, :order => 'id')
stories_wo_position = self.fixed_issues.find(:all, :conditions => {:project_id => project, :type_id => Story.types, :position => nil}, :order => 'id')
stories_w_position = self.fixed_issues.find(:all, :conditions => ['project_id = ? AND tracker_id IN (?) AND position IS NOT NULL', project, Story.trackers], :order => 'COALESCE(position, 0), id')
stories_w_position = self.fixed_issues.find(:all, :conditions => ['project_id = ? AND type_id IN (?) AND position IS NOT NULL', project, Story.types], :order => 'COALESCE(position, 0), id')
(stories_w_position + stories_wo_position).each_with_index do |story, index|
story.send(:update_attribute_silently, 'position', index + 1)

@ -133,7 +133,7 @@ module OpenProject::Backlogs::Patches::WorkPackagePatch
elsif self.is_task?
# Make sure to get the closest ancestor that is a Story, i.e. the one with the highest lft
# otherwise, the highest parent that is a Story is returned
story_work_package = self.ancestors.find_by_tracker_id(Story.trackers, :order => 'lft DESC')
story_work_package = self.ancestors.find_by_type_id(Story.types, :order => 'lft DESC')
return Story.find(story_work_package.id) if story_work_package
end
nil
@ -178,8 +178,8 @@ module OpenProject::Backlogs::Patches::WorkPackagePatch
!!self.project.try(:module_enabled?, "backlogs")
end
def in_backlogs_tracker?
backlogs_enabled? && WorkPackage.backlogs_trackers.include?(self.tracker.try(:id))
def in_backlogs_type?
backlogs_enabled? && WorkPackage.backlogs_types.include?(self.type.try(:id))
end
# ancestors array similar to Module#ancestors
@ -200,12 +200,12 @@ module OpenProject::Backlogs::Patches::WorkPackagePatch
end
def closest_story_or_impediment
return nil unless in_backlogs_tracker?
return nil unless in_backlogs_type?
return self if (self.is_story? || self.is_impediment?)
closest = nil
ancestor_chain.each do |i|
# break if we found an element in our chain that is not relevant in backlogs
break unless i.in_backlogs_tracker?
break unless i.in_backlogs_type?
if (i.is_story? || i.is_impediment?)
closest = i
break
@ -217,7 +217,7 @@ module OpenProject::Backlogs::Patches::WorkPackagePatch
private
def backlogs_before_validation
if self.tracker_id == Task.tracker
if self.type_id == Task.type
self.estimated_hours = self.remaining_hours if self.estimated_hours.blank? && ! self.remaining_hours.blank?
self.remaining_hours = self.estimated_hours if self.remaining_hours.blank? && ! self.estimated_hours.blank?
end

@ -49,7 +49,7 @@ class OpenProject::Backlogs::IssueView::IssueHierarchyParagraph < OpenProject::N
css_classes << "idnt" << "idnt-#{level}" if level > 0
if @issue == issue
issue_text = t.link_to("#{issue.tracker.name} ##{issue.id}",
issue_text = t.link_to("#{issue.type.name} ##{issue.id}",
'javascript:void(0)',
:style => "color:inherit; font-weight: bold",
:class => issue.css_classes)
@ -61,7 +61,7 @@ class OpenProject::Backlogs::IssueView::IssueHierarchyParagraph < OpenProject::N
elsif relation == "child"
title << content_tag(:span, l(:description_sub_issue), :class => "hidden-for-sighted")
end
title << " #{issue.tracker.name} ##{issue.id}"
title << " #{issue.type.name} ##{issue.id}"
issue_text = t.link_to_issue_box(title.html_safe, issue, :class => issue.css_classes)
end

@ -4,10 +4,10 @@ roles: {member: Teamlid}
issue_types:
Impediment:
states: {closed: Closed, open: New}
tracker: Impediment
type: Impediment
Story:
states: {Accepted: Accepted, Completed: RFI, Defined: New, Failed: Failed, In Progress: RFI, Specified: RFI}
tracker: Story
type: Story
Task:
states: {Done: Done, Defined: New, In Progress: In Progress}
tracker: Task
type: Task

@ -43,15 +43,15 @@ namespace :redmine do
settings["card_spec"] ||= Cards::TaskboardCards::LABELS.keys[0] unless Cards::TaskboardCards::LABELS.size == 0
trackers = Tracker.find(:all)
types = Type.find(:all)
if Story.trackers.length == 0
puts "Configuring story and task trackers..."
if Story.types.length == 0
puts "Configuring story and task types..."
invalid = true
while invalid
puts "-----------------------------------------------------"
puts "Which trackers do you want to use for your stories?"
trackers.each_with_index { |t, i| puts " #{ i + 1 }. #{ t.name }" }
puts "Which types do you want to use for your stories?"
types.each_with_index { |t, i| puts " #{ i + 1 }. #{ t.name }" }
print "Separate values with a space (e.g. 1 3): "
STDOUT.flush
selection = (STDIN.gets.chomp!).split(/\D+/)
@ -59,52 +59,52 @@ namespace :redmine do
# Check that all values correspond to an items in the list
invalid = false
invalid_value = nil
tracker_names = []
type_names = []
selection.each do |s|
if s.to_i > trackers.length
if s.to_i > types.length
invalid = true
invalid_value = s
break
else
tracker_names << trackers[s.to_i-1].name
type_names << types[s.to_i-1].name
end
end
if invalid
puts "Oooops! You entered an invalid value (#{invalid_value}). Please try again."
else
print "You selected the following trackers: #{tracker_names.join(', ')}. Is this correct? (y/n) "
print "You selected the following types: #{type_names.join(', ')}. Is this correct? (y/n) "
STDOUT.flush
invalid = !(STDIN.gets.chomp!).match("y")
end
end
settings["story_trackers"] = selection.map{ |s| trackers[s.to_i-1].id }
settings["story_types"] = selection.map{ |s| types[s.to_i-1].id }
end
if !Task.tracker
# Check if there is at least one tracker available
if !Task.type
# Check if there is at least one type available
puts "-----------------------------------------------------"
if settings["story_trackers"].length < trackers.length
if settings["story_types"].length < types.length
invalid = true
while invalid
# If there's at least one, ask the user to pick one
puts "Which tracker do you want to use for your tasks?"
available_trackers = trackers.select{|t| !settings["story_trackers"].include? t.id}
puts "Which type do you want to use for your tasks?"
available_types = types.select{|t| !settings["story_types"].include? t.id}
j = 0
available_trackers.each_with_index { |t, i| puts " #{ j = i + 1 }. #{ t.name }" }
available_types.each_with_index { |t, i| puts " #{ j = i + 1 }. #{ t.name }" }
print "Choose one from above: "
STDOUT.flush
selection = (STDIN.gets.chomp!).split(/\D+/)
if selection.length > 0 and selection.first.to_i <= available_trackers.length
if selection.length > 0 and selection.first.to_i <= available_types.length
# If the user picked one, use that
print "You selected #{available_trackers[selection.first.to_i-1].name}. Is this correct? (y/n) "
print "You selected #{available_types[selection.first.to_i-1].name}. Is this correct? (y/n) "
STDOUT.flush
if (STDIN.gets.chomp!).match("y")
settings["task_tracker"] = available_trackers[selection.first.to_i-1].id
settings["task_type"] = available_types[selection.first.to_i-1].id
invalid = false
end
else
@ -113,8 +113,8 @@ namespace :redmine do
end
else
# If there's none, ask to create one
puts "You don't have any trackers available for use with tasks."
puts "Please create a new tracker via the Redmine admin interface,"
puts "You don't have any types available for use with tasks."
puts "Please create a new type via the Redmine admin interface,"
puts "then re-run this installer. Press any key to continue."
STDOUT.flush
STDIN.gets
@ -124,7 +124,7 @@ namespace :redmine do
# Necessary because adding key-value pairs one by one doesn't seem to work
Setting.plugin_openproject_backlogs = settings
puts "Story and task trackers are now set."
puts "Story and task types are now set."
puts "Migrating the database..."
STDOUT.flush

@ -1,6 +1,6 @@
FactoryGirl.define do
factory :impediment do
association :tracker, :factory => :tracker_task
association :type, :factory => :type_task
subject "Impeding progress"
description "Unable to print recipes"
association :priority, :factory => :priority

@ -3,7 +3,7 @@ FactoryGirl.define do
association :priority, :factory => :priority
sequence(:subject) { |n| "story#{n}" }
description "story story story"
association :tracker, :factory => :tracker_feature
association :type, :factory => :type_feature
association :author, :factory => :user
end
end

@ -1,6 +1,6 @@
FactoryGirl.define do
factory :task do
association :tracker, :factory => :tracker_task
association :type, :factory => :type_task
subject "Printing Recipes"
description "Just printing recipes"
association :priority, :factory => :priority

@ -4,12 +4,12 @@ describe Backlog do
let(:project) { FactoryGirl.build(:project) }
before(:each) do
@feature = FactoryGirl.create(:tracker_feature)
@feature = FactoryGirl.create(:type_feature)
Setting.plugin_openproject_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [@feature.id.to_s],
"task_tracker" => "0"}
"story_types" => [@feature.id.to_s],
"task_type" => "0"}
@status = FactoryGirl.create(:issue_status)
end
@ -18,7 +18,7 @@ describe Backlog do
describe "WITH one open version defined in the project" do
before(:each) do
@project = project
@issues = [FactoryGirl.create(:issue, :subject => "issue1", :project => @project, :tracker => @feature, :status => @status)]
@issues = [FactoryGirl.create(:issue, :subject => "issue1", :project => @project, :type => @feature, :status => @status)]
@version = FactoryGirl.create(:version, :project => project, :fixed_issues => @issues)
@version_settings = @version.version_settings.create(:display => VersionSetting::DISPLAY_RIGHT, :project => project)
end

@ -18,8 +18,8 @@ describe Burndown do
let(:user) { @user ||= FactoryGirl.create(:user) }
let(:role) { @role ||= FactoryGirl.create(:role) }
let(:tracker_feature) { @tracker_feature ||= FactoryGirl.create(:tracker_feature) }
let(:tracker_task) { @tracker_task ||= FactoryGirl.create(:tracker_task) }
let(:type_feature) { @type_feature ||= FactoryGirl.create(:type_feature) }
let(:type_task) { @type_task ||= FactoryGirl.create(:type_task) }
let(:issue_priority) { @issue_priority ||= FactoryGirl.create(:priority, :is_default => true) }
let(:version) { @version ||= FactoryGirl.create(:version, :project => project) }
let(:sprint) { @sprint ||= Sprint.find(version.id) }
@ -45,8 +45,8 @@ describe Burndown do
Setting.plugin_openproject_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id.to_s],
"task_tracker" => tracker_task.id.to_s }
"story_types" => [type_feature.id.to_s],
"task_type" => type_task.id.to_s }
project.save!
@ -71,7 +71,7 @@ describe Burndown do
@story = FactoryGirl.build(:story, :subject => "Story 1",
:project => project,
:fixed_version => version,
:tracker => tracker_feature,
:type => type_feature,
:status => issue_open,
:priority => issue_priority,
:created_at => Date.today - 20.days,
@ -135,13 +135,13 @@ describe Burndown do
it { @burndown.remaining_hours_ideal.should eql [9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0, 0.0] }
end
describe "WITH the story being moved to another tracker within the sprint duration and also moved back in" do
describe "WITH the story being moved to another type within the sprint duration and also moved back in" do
before(:each) do
other_tracker = FactoryGirl.create(:tracker_bug)
project.trackers << other_tracker
other_type = FactoryGirl.create(:type_bug)
project.types << other_type
set_attribute_journalized @story, :tracker_id=, other_tracker.id, Time.now - 6.days
set_attribute_journalized @story, :tracker_id=, tracker_feature.id, Time.now - 3.days
set_attribute_journalized @story, :type_id=, other_type.id, Time.now - 6.days
set_attribute_journalized @story, :type_id=, type_feature.id, Time.now - 3.days
@burndown = Burndown.new(sprint, project)
end
@ -161,7 +161,7 @@ describe Burndown do
@task = FactoryGirl.build(:task, :subject => "Task 1",
:project => project,
:fixed_version => version,
:tracker => tracker_task,
:type => type_task,
:status => issue_open,
:remaining_hours => 18,
:parent_issue_id => @story.id,
@ -240,7 +240,7 @@ describe Burndown do
@stories[i] = FactoryGirl.create(:story, :subject => "Story #{i}",
:project => project,
:fixed_version => version,
:tracker => tracker_feature,
:type => type_feature,
:status => issue_open,
:priority => issue_priority,
:created_at => Date.today - (20 - i).days,

@ -3,15 +3,15 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Impediment do
let(:user) { @user ||= FactoryGirl.create(:user) }
let(:role) { @role ||= FactoryGirl.create(:role) }
let(:tracker_feature) { @tracker_feature ||= FactoryGirl.create(:tracker_feature) }
let(:tracker_task) { @tracker_task ||= FactoryGirl.create(:tracker_task) }
let(:type_feature) { @type_feature ||= FactoryGirl.create(:type_feature) }
let(:type_task) { @type_task ||= FactoryGirl.create(:type_task) }
let(:issue_priority) { @issue_priority ||= FactoryGirl.create(:priority, :is_default => true) }
let(:task) { FactoryGirl.build(:task, :tracker => tracker_task,
let(:task) { FactoryGirl.build(:task, :type => type_task,
:project => project,
:author => user,
:priority => issue_priority,
:status => issue_status1) }
let(:feature) { FactoryGirl.build(:issue, :tracker => tracker_feature,
let(:feature) { FactoryGirl.build(:issue, :type => type_feature,
:project => project,
:author => user,
:priority => issue_priority,
@ -30,7 +30,7 @@ describe Impediment do
let(:issue_status1) { @status1 ||= FactoryGirl.create(:issue_status, :name => "status 1", :is_default => true) }
let(:issue_status2) { @status2 ||= FactoryGirl.create(:issue_status, :name => "status 2") }
let(:tracker_workflow) { @workflow ||= Workflow.create(:tracker_id => tracker_task.id,
let(:type_workflow) { @workflow ||= Workflow.create(:type_id => type_task.id,
:old_status => issue_status1,
:new_status => issue_status2,
:role => role) }
@ -39,7 +39,7 @@ describe Impediment do
:assigned_to => user,
:priority => issue_priority,
:project => project,
:tracker => tracker_task,
:type => type_task,
:status => issue_status1)}
before(:each) do
@ -48,14 +48,14 @@ describe Impediment do
Setting.plugin_openproject_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id.to_s],
"task_tracker" => tracker_task.id.to_s }
"story_types" => [type_feature.id.to_s],
"task_type" => type_task.id.to_s }
User.stub!(:current).and_return(user)
issue_priority.save
issue_status1.save
project.save
tracker_workflow.save
type_workflow.save
end
describe "class methods" do
@ -73,7 +73,7 @@ describe Impediment do
it { @impediment.fixed_version.should eql version }
it { @impediment.priority.should eql issue_priority}
it { @impediment.status.should eql issue_status1 }
it { @impediment.tracker.should eql tracker_task }
it { @impediment.type.should eql type_task }
it { @impediment.assigned_to.should eql user }
end
@ -178,7 +178,7 @@ describe Impediment do
it { @impediment.fixed_version.should eql version }
it { @impediment.priority.should eql issue_priority}
it { @impediment.status.should eql issue_status1 }
it { @impediment.tracker.should eql tracker_task }
it { @impediment.type.should eql type_task }
it { @impediment.blocks_ids.should eql @blocks.split(/\D+/).map{|id| id.to_i} }
end
@ -201,7 +201,7 @@ describe Impediment do
describe "WHEN changing the blocking relationship to another story" do
before(:each) do
@story = FactoryGirl.build(:issue, :subject => "another story",
:tracker => tracker_feature,
:type => type_feature,
:project => project,
:author => user,
:priority => issue_priority,

@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe WorkPackage, "changing a story's fixed_version changes the fixed_version of all it's tasks (and the tasks beyond)" do
let(:tracker_feature) { FactoryGirl.build(:tracker_feature) }
let(:tracker_task) { FactoryGirl.build(:tracker_task) }
let(:tracker_bug) { FactoryGirl.build(:tracker_bug) }
let(:type_bug) { FactoryGirl.build(:type_bug) }
let(:version1) { project.versions.first }
let(:version2) { project.versions.last }
let(:role) { FactoryGirl.build(:role) }
@ -15,7 +15,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
p = FactoryGirl.build(:project, :members => [FactoryGirl.build(:member,
:principal => user,
:roles => [role])],
:trackers => [tracker_feature, tracker_task, tracker_bug])
:types => [type_feature, type_task, type_bug])
p.versions << FactoryGirl.build(:version, :name => "Version1", :project => p)
p.versions << FactoryGirl.build(:version, :name => "Version2", :project => p)
@ -28,7 +28,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
story = FactoryGirl.build(:work_package,
:subject => "Story",
:project => project,
:tracker => tracker_feature,
:type => type_feature,
:fixed_version => version1,
:status => issue_status,
:author => user,
@ -40,7 +40,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
story = FactoryGirl.build(:work_package,
:subject => "Story2",
:project => project,
:tracker => tracker_feature,
:type => type_feature,
:fixed_version => version1,
:status => issue_status,
:author => user,
@ -52,7 +52,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
story = FactoryGirl.build(:work_package,
:subject => "Story3",
:project => project,
:tracker => tracker_feature,
:type => type_feature,
:fixed_version => version1,
:status => issue_status,
:author => user,
@ -62,7 +62,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:task) { FactoryGirl.build(:work_package,
:subject => "Task",
:tracker => tracker_task,
:type => type_task,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -71,7 +71,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:task2) { FactoryGirl.build(:work_package,
:subject => "Task2",
:tracker => tracker_task,
:type => type_task,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -80,7 +80,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:task3) { FactoryGirl.build(:work_package,
:subject => "Task3",
:tracker => tracker_task,
:type => type_task,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -89,7 +89,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:task4) { FactoryGirl.build(:work_package,
:subject => "Task4",
:tracker => tracker_task,
:type => type_task,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -98,7 +98,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:task5) { FactoryGirl.build(:work_package,
:subject => "Task5",
:tracker => tracker_task,
:type => type_task,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -107,7 +107,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:task6) { FactoryGirl.build(:work_package,
:subject => "Task6",
:tracker => tracker_task,
:type => type_task,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -116,7 +116,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:bug) { FactoryGirl.build(:work_package,
:subject => "Bug",
:tracker => tracker_bug,
:type => type_bug,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -125,7 +125,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:bug2) { FactoryGirl.build(:work_package,
:subject => "Bug2",
:tracker => tracker_bug,
:type => type_bug,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -134,7 +134,7 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
let(:bug3) { FactoryGirl.build(:work_package,
:subject => "Bug3",
:tracker => tracker_bug,
:type => type_bug,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -147,8 +147,8 @@ describe WorkPackage, "changing a story's fixed_version changes the fixed_versio
Setting.plugin_openproject_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id],
"task_tracker" => tracker_task.id.to_s}
"story_types" => [type_feature.id],
"task_type" => type_task.id.to_s}
end
def standard_child_layout

@ -1,9 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe WorkPackage, "fixed version restricted by an work_package parents (if it's a task)" do
let(:tracker_feature) { FactoryGirl.build(:tracker_feature) }
let(:tracker_task) { FactoryGirl.build(:tracker_task) }
let(:tracker_bug) { FactoryGirl.build(:tracker_bug) }
let(:type_feature) { FactoryGirl.build(:type_feature) }
let(:type_task) { FactoryGirl.build(:type_task) }
let(:type_bug) { FactoryGirl.build(:type_bug) }
let(:version1) { project.versions.first }
let(:version2) { project.versions.last }
let(:role) { FactoryGirl.build(:role) }
@ -15,7 +15,7 @@ describe WorkPackage, "fixed version restricted by an work_package parents (if i
p = FactoryGirl.build(:project, :members => [FactoryGirl.build(:member,
:principal => user,
:roles => [role])],
:trackers => [tracker_feature, tracker_task, tracker_bug])
:types => [type_feature, type_task, type_bug])
p.versions << FactoryGirl.build(:version, :name => "Version1", :project => p)
p.versions << FactoryGirl.build(:version, :name => "Version2", :project => p)
@ -28,7 +28,7 @@ describe WorkPackage, "fixed version restricted by an work_package parents (if i
story = FactoryGirl.build(:work_package,
:subject => "Story",
:project => project,
:tracker => tracker_feature,
:type => type_feature,
:fixed_version => version1,
:status => issue_status,
:author => user,
@ -41,7 +41,7 @@ describe WorkPackage, "fixed version restricted by an work_package parents (if i
story = FactoryGirl.build(:work_package,
:subject => "Story2",
:project => project,
:tracker => tracker_feature,
:type => type_feature,
:fixed_version => version1,
:status => issue_status,
:author => user,
@ -53,7 +53,7 @@ describe WorkPackage, "fixed version restricted by an work_package parents (if i
let(:task) { FactoryGirl.build(:work_package,
:subject => "Task",
:tracker => tracker_task,
:type => type_task,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -62,7 +62,7 @@ describe WorkPackage, "fixed version restricted by an work_package parents (if i
let(:task2) { FactoryGirl.build(:work_package,
:subject => "Task2",
:tracker => tracker_task,
:type => type_task,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -71,7 +71,7 @@ describe WorkPackage, "fixed version restricted by an work_package parents (if i
let(:bug) { FactoryGirl.build(:work_package,
:subject => "Bug",
:tracker => tracker_bug,
:type => type_bug,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -80,7 +80,7 @@ describe WorkPackage, "fixed version restricted by an work_package parents (if i
let(:bug2) { FactoryGirl.build(:work_package,
:subject => "Bug2",
:tracker => tracker_bug,
:type => type_bug,
:fixed_version => version1,
:project => project,
:status => issue_status,
@ -247,8 +247,8 @@ describe WorkPackage, "fixed version restricted by an work_package parents (if i
Setting.plugin_openproject_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id],
"task_tracker" => tracker_task.id.to_s}
"story_types" => [type_feature.id],
"task_type" => type_task.id.to_s}
end
describe "WITH a story" do

@ -14,9 +14,9 @@ def project_boundaries_spanning_work_package_hierarchy_allowed?
end
describe WorkPackage, 'parent-child relationships between backlogs stories and backlogs tasks are prohibited if they span project boundaries' do
let(:tracker_feature) { FactoryGirl.build(:tracker_feature) }
let(:tracker_task) { FactoryGirl.build(:tracker_task) }
let(:tracker_bug) { FactoryGirl.build(:tracker_bug) }
let(:type_feature) { FactoryGirl.build(:type_feature) }
let(:type_task) { FactoryGirl.build(:type_task) }
let(:type_bug) { FactoryGirl.build(:type_bug) }
let(:version1) { project.versions.first }
let(:version2) { project.versions.last }
let(:role) { FactoryGirl.build(:role) }
@ -29,7 +29,7 @@ describe WorkPackage, 'parent-child relationships between backlogs stories and b
:members => [FactoryGirl.build(:member,
:principal => user,
:roles => [role])],
:trackers => [tracker_feature, tracker_task, tracker_bug])
:types => [type_feature, type_task, type_bug])
p.versions << FactoryGirl.build(:version, :name => "Version1", :project => p)
p.versions << FactoryGirl.build(:version, :name => "Version2", :project => p)
@ -42,7 +42,7 @@ describe WorkPackage, 'parent-child relationships between backlogs stories and b
:members => [FactoryGirl.build(:member,
:principal => user,
:roles => [role])],
:trackers => [tracker_feature, tracker_task, tracker_bug])
:types => [type_feature, type_task, type_bug])
p.versions << FactoryGirl.build(:version, :name => "Version1", :project => p)
p.versions << FactoryGirl.build(:version, :name => "Version2", :project => p)
@ -52,42 +52,42 @@ describe WorkPackage, 'parent-child relationships between backlogs stories and b
let(:story) { FactoryGirl.build(:work_package,
:subject => "Story",
:tracker => tracker_feature,
:type => type_feature,
:status => issue_status,
:author => user,
:priority => issue_priority) }
let(:story2) { FactoryGirl.build(:work_package,
:subject => "Story2",
:tracker => tracker_feature,
:type => type_feature,
:status => issue_status,
:author => user,
:priority => issue_priority) }
let(:task) { FactoryGirl.build(:work_package,
:subject => "Task",
:tracker => tracker_task,
:type => type_task,
:status => issue_status,
:author => user,
:priority => issue_priority) }
let(:task2) { FactoryGirl.build(:work_package,
:subject => "Task2",
:tracker => tracker_task,
:type => type_task,
:status => issue_status,
:author => user,
:priority => issue_priority) }
let(:bug) { FactoryGirl.build(:work_package,
:subject => "Bug",
:tracker => tracker_bug,
:type => type_bug,
:status => issue_status,
:author => user,
:priority => issue_priority) }
let(:bug2) { FactoryGirl.build(:work_package,
:subject => "Bug2",
:tracker => tracker_bug,
:type => type_bug,
:status => issue_status,
:author => user,
:priority => issue_priority) }
@ -109,8 +109,8 @@ describe WorkPackage, 'parent-child relationships between backlogs stories and b
Setting.plugin_openproject_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id],
"task_tracker" => tracker_task.id.to_s}
"story_types" => [type_feature.id],
"task_type" => type_task.id.to_s}
end
if project_boundaries_spanning_work_package_hierarchy_allowed?

@ -40,7 +40,7 @@ describe WorkPackage do
:tracker_id => other_tracker.id) }
let(:task_1) { create_work_package(:subject => 'Task 1', :fixed_version_id => sprint_1.id,
:tracker_id => task_tracker.id) }
:type_id => task_type.id) }
before do
# had problems while writing these specs, that some elements kept creaping
@ -51,18 +51,18 @@ describe WorkPackage do
IssuePriority.delete_all
IssueStatus.delete_all
Project.delete_all
Tracker.delete_all
Type.delete_all
Version.delete_all
# enable and configure backlogs
project.enabled_module_names = project.enabled_module_names + ["backlogs"]
Setting.plugin_openproject_backlogs = {"story_trackers" => [story_tracker.id, epic_tracker.id],
"task_tracker" => task_tracker.id}
Setting.plugin_openproject_backlogs = {"story_types" => [story_type.id, epic_type.id],
"task_type" => task_type.id}
# otherwise the tracker id's from the previous test are still active
WorkPackage.instance_variable_set(:@backlogs_trackers, nil)
# otherwise the type id's from the previous test are still active
WorkPackage.instance_variable_set(:@backlogs_types, nil)
project.trackers = [story_tracker, epic_tracker, task_tracker, other_tracker]
project.types = [story_type, epic_type, task_type, other_type]
sprint_1
sprint_2
@ -127,74 +127,74 @@ describe WorkPackage do
end
end
describe '- Changing the tracker' do
describe 'by moving a story to another story tracker' do
describe '- Changing the type' do
describe 'by moving a story to another story type' do
it 'keeps all positions in the sprint in tact' do
work_package_3.tracker = epic_tracker
work_package_3.type = epic_type
work_package_3.save!
[work_package_1, work_package_2, work_package_3, work_package_4, work_package_5].each(&:reload).map(&:position).should == [1, 2, 3, 4, 5]
end
end
describe 'by moving a story to a non-backlogs tracker' do
describe 'by moving a story to a non-backlogs type' do
it 'removes it from any list' do
work_package_3.tracker = other_tracker
work_package_3.type = other_type
work_package_3.save!
work_package_3.should_not be_in_list
end
it 'reorders the remaining stories' do
work_package_3.tracker = other_tracker
work_package_3.type = other_type
work_package_3.save!
[work_package_1, work_package_2, work_package_4, work_package_5].each(&:reload).map(&:position).should == [1, 2, 3, 4]
end
end
describe 'by moving a story to the task tracker' do
describe 'by moving a story to the task type' do
it 'removes it from any list' do
work_package_3.tracker = task_tracker
work_package_3.type = task_type
work_package_3.save!
work_package_3.should_not be_in_list
end
it 'reorders the remaining stories' do
work_package_3.tracker = task_tracker
work_package_3.type = task_type
work_package_3.save!
[work_package_1, work_package_2, work_package_4, work_package_5].each(&:reload).map(&:position).should == [1, 2, 3, 4]
end
end
describe 'by moving a task to the story tracker' do
describe 'by moving a task to the story type' do
it 'adds it to the top of the list' do
task_1.tracker = story_tracker
task_1.type = story_type
task_1.save!
task_1.should be_first
end
it 'reorders the existing stories' do
task_1.tracker = story_tracker
task_1.type = story_type
task_1.save!
[task_1, work_package_1, work_package_2, work_package_3, work_package_4, work_package_5].each(&:reload).map(&:position).should == [1, 2, 3, 4, 5, 6]
end
end
describe 'by moving a non-backlogs work_package to a story tracker' do
describe 'by moving a non-backlogs work_package to a story type' do
it 'adds it to the top of the list' do
feedback_1.tracker = story_tracker
feedback_1.type = story_type
feedback_1.save!
feedback_1.should be_first
end
it 'reorders the existing stories' do
feedback_1.tracker = story_tracker
feedback_1.type = story_type
feedback_1.save!
[feedback_1, work_package_1, work_package_2, work_package_3, work_package_4, work_package_5].each(&:reload).map(&:position).should == [1, 2, 3, 4, 5, 6]
@ -224,8 +224,8 @@ describe WorkPackage do
project_wo_backlogs.enabled_module_names = project_wo_backlogs.enabled_module_names - ["backlogs"]
sub_project_wo_backlogs.enabled_module_names = sub_project_wo_backlogs.enabled_module_names - ["backlogs"]
project_wo_backlogs.trackers = [story_tracker, task_tracker, other_tracker]
sub_project_wo_backlogs.trackers = [story_tracker, task_tracker, other_tracker]
project_wo_backlogs.types = [story_type, task_type, other_type]
sub_project_wo_backlogs.types = [story_type, task_type, other_type]
sub_project_wo_backlogs.move_to_child_of(project)

@ -108,7 +108,7 @@ describe WorkPackage do
@work_package = FactoryGirl.build(:work_package, :project => @project,
:status => @status_open,
:tracker => FactoryGirl.build(:tracker_feature))
:type => FactoryGirl.build(:type_feature))
end
it 'should not be done when having the initial status "open"' do

@ -4,27 +4,27 @@ describe Story do
let(:user) { @user ||= FactoryGirl.create(:user) }
let(:role) { @role ||= FactoryGirl.create(:role) }
let(:issue_status1) { @status1 ||= FactoryGirl.create(:issue_status, :name => "status 1", :is_default => true) }
let(:tracker_feature) { @tracker_feature ||= FactoryGirl.create(:tracker_feature) }
let(:type_feature) { @type_feature ||= FactoryGirl.create(:type_feature) }
let(:version) { @version ||= FactoryGirl.create(:version, :project => project) }
let(:version2) { FactoryGirl.create(:version, :project => project) }
let(:sprint) { @sprint ||= FactoryGirl.create(:sprint, :project => project) }
let(:issue_priority) { @issue_priority ||= FactoryGirl.create(:priority) }
let(:task_tracker) { FactoryGirl.create(:tracker_task) }
let(:task_type) { FactoryGirl.create(:type_task) }
let(:task) { FactoryGirl.create(:story, :fixed_version => version,
:project => project,
:status => issue_status1,
:tracker => task_tracker,
:type => task_type,
:priority => issue_priority) }
let(:story1) { FactoryGirl.create(:story, :fixed_version => version,
:project => project,
:status => issue_status1,
:tracker => tracker_feature,
:type => type_feature,
:priority => issue_priority) }
let(:story2) { FactoryGirl.create(:story, :fixed_version => version,
:project => project,
:status => issue_status1,
:tracker => tracker_feature,
:type => type_feature,
:priority => issue_priority) }
let(:project) do
@ -43,8 +43,8 @@ describe Story do
Setting.plugin_openproject_backlogs = {"points_burn_direction" => "down",
"wiki_template" => "",
"card_spec" => "Sattleford VM-5040",
"story_trackers" => [tracker_feature.id.to_s],
"task_tracker" => task_tracker.id.to_s }
"story_types" => [type_feature.id.to_s],
"task_type" => task_type.id.to_s }
end
describe "Class methods" do
@ -176,11 +176,11 @@ describe Story do
@story = FactoryGirl.create(:story, :fixed_version => version,
:project => project,
:status => issue_status1,
:tracker => tracker_feature,
:type => type_feature,
:priority => issue_priority)
@story.project.enabled_module_names += ["backlogs"]
@issue ||= FactoryGirl.create(:issue, :project => project, :status => issue_status1, :tracker => tracker_feature, :author => @current)
@issue ||= FactoryGirl.create(:issue, :project => project, :status => issue_status1, :type => type_feature, :author => @current)
end
it "should create a journal when adding a subtask which has remaining hours set" do

@ -19,10 +19,10 @@ describe Version do
let(:priority) { FactoryGirl.create(:priority_normal) }
let(:project) { FactoryGirl.create(:project) }
let(:epic_tracker) { FactoryGirl.create(:tracker, :name => 'Epic') }
let(:story_tracker) { FactoryGirl.create(:tracker, :name => 'Story') }
let(:task_tracker) { FactoryGirl.create(:tracker, :name => 'Task') }
let(:other_tracker) { FactoryGirl.create(:tracker, :name => 'Other') }
let(:epic_type) { FactoryGirl.create(:type, :name => 'Epic') }
let(:story_type) { FactoryGirl.create(:type, :name => 'Story') }
let(:task_type) { FactoryGirl.create(:type, :name => 'Task') }
let(:other_type) { FactoryGirl.create(:type, :name => 'Other') }
let(:version) { FactoryGirl.create(:version, :project_id => project.id, :name => 'Version') }
@ -35,18 +35,18 @@ describe Version do
IssuePriority.delete_all
IssueStatus.delete_all
Project.delete_all
Tracker.delete_all
Type.delete_all
Version.delete_all
# enable and configure backlogs
project.enabled_module_names = project.enabled_module_names + ["backlogs"]
Setting.plugin_openproject_backlogs = {"story_trackers" => [epic_tracker.id, story_tracker.id],
"task_tracker" => task_tracker.id}
Setting.plugin_openproject_backlogs = {"story_types" => [epic_type.id, story_type.id],
"task_type" => task_type.id}
# otherwise the tracker id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_trackers, nil)
# otherwise the type id's from the previous test are still active
Issue.instance_variable_set(:@backlogs_types, nil)
project.trackers = [epic_tracker, story_tracker, task_tracker, other_tracker]
project.types = [epic_type, story_type, task_type, other_type]
version
end
@ -56,9 +56,9 @@ describe Version do
project2.save!
project2.reload
issue1 = FactoryGirl.create(:issue, :tracker_id => task_tracker.id, :status_id => status.id, :project_id => project.id)
issue2 = FactoryGirl.create(:issue, :parent_issue_id => issue1.id, :tracker_id => task_tracker.id, :status_id => status.id, :project_id => project.id)
issue3 = FactoryGirl.create(:issue, :parent_issue_id => issue2.id, :tracker_id => task_tracker.id, :status_id => status.id, :project_id => project.id)
issue1 = FactoryGirl.create(:issue, :type_id => task_type.id, :status_id => status.id, :project_id => project.id)
issue2 = FactoryGirl.create(:issue, :parent_issue_id => issue1.id, :type_id => task_type.id, :status_id => status.id, :project_id => project.id)
issue3 = FactoryGirl.create(:issue, :parent_issue_id => issue2.id, :type_id => task_type.id, :status_id => status.id, :project_id => project.id)
issue1.reload
issue1.fixed_version_id = version.id
@ -90,13 +90,13 @@ describe Version do
end
it 'rebuilds postions' do
e1 = create_issue(:tracker_id => epic_tracker.id)
s2 = create_issue(:tracker_id => story_tracker.id)
s3 = create_issue(:tracker_id => story_tracker.id)
s4 = create_issue(:tracker_id => story_tracker.id)
s5 = create_issue(:tracker_id => story_tracker.id)
t3 = create_issue(:tracker_id => task_tracker.id)
o9 = create_issue(:tracker_id => other_tracker.id)
e1 = create_issue(:type_id => epic_type.id)
s2 = create_issue(:type_id => story_type.id)
s3 = create_issue(:type_id => story_type.id)
s4 = create_issue(:type_id => story_type.id)
s5 = create_issue(:type_id => story_type.id)
t3 = create_issue(:type_id => task_type.id)
o9 = create_issue(:type_id => other_type.id)
[e1, s2, s3, s4, s5].each(&:move_to_bottom)

@ -1,33 +1,33 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe WorkPackage do
describe :backlogs_trackers do
it "should return all the ids of trackers that are configures to be considered backlogs trackers" do
Setting.plugin_openproject_backlogs = { "story_trackers" => [1],
"task_tracker" => 2 }
describe :backlogs_types do
it "should return all the ids of types that are configures to be considered backlogs types" do
Setting.plugin_openproject_backlogs = { "story_types" => [1],
"task_type" => 2 }
WorkPackage.backlogs_trackers.should =~ [1,2]
WorkPackage.backlogs_types.should =~ [1,2]
end
it "should return an empty array if nothing is defined" do
Setting.plugin_openproject_backlogs = { }
WorkPackage.backlogs_trackers.should == []
WorkPackage.backlogs_types.should == []
end
it 'should reflect changes to the configuration' do
Setting.plugin_openproject_backlogs = { "story_trackers" => [1],
"task_tracker" => 2 }
Setting.plugin_openproject_backlogs = { "story_types" => [1],
"task_type" => 2 }
WorkPackage.backlogs_trackers.should =~ [1,2]
WorkPackage.backlogs_types.should =~ [1,2]
Setting.plugin_openproject_backlogs = { "story_trackers" => [3],
"task_tracker" => 4 }
Setting.plugin_openproject_backlogs = { "story_types" => [3],
"task_type" => 4 }
Setting.plugin_openproject_backlogs["story_trackers"] = [3]
Setting.plugin_openproject_backlogs["task_tracker"] = [4]
Setting.plugin_openproject_backlogs["story_types"] = [3]
Setting.plugin_openproject_backlogs["task_type"] = [4]
WorkPackage.backlogs_trackers.should =~ [3,4]
WorkPackage.backlogs_types.should =~ [3,4]
end
end
end

@ -12,11 +12,11 @@ describe 'rb_taskboards/show' do
FactoryGirl.create(:issue_status),
FactoryGirl.create(:issue_status)] }
let(:tracker_task) { FactoryGirl.create(:tracker_task) }
let(:tracker_feature) { FactoryGirl.create(:tracker_feature) }
let(:type_task) { FactoryGirl.create(:type_task) }
let(:type_feature) { FactoryGirl.create(:type_feature) }
let(:issue_priority) { FactoryGirl.create(:priority) }
let(:project) do
project = FactoryGirl.create(:project, :trackers => [tracker_feature, tracker_task])
project = FactoryGirl.create(:project, :types => [type_feature, type_task])
project.members = [FactoryGirl.create(:member, :principal => user1,:project => project,:roles => [role_allowed]),
FactoryGirl.create(:member, :principal => user2,:project => project,:roles => [role_forbidden])]
project
@ -24,36 +24,36 @@ describe 'rb_taskboards/show' do
let(:story_a) { FactoryGirl.create(:story, :status => statuses[0],
:project => project,
:tracker => tracker_feature,
:type => type_feature,
:fixed_version => sprint,
:priority => issue_priority
)}
let(:story_b) { FactoryGirl.create(:story, :status => statuses[1],
:project => project,
:tracker => tracker_feature,
:type => type_feature,
:fixed_version => sprint,
:priority => issue_priority
)}
let(:story_c) { FactoryGirl.create(:story, :status => statuses[2],
:project => project,
:tracker => tracker_feature,
:type => type_feature,
:fixed_version => sprint,
:priority => issue_priority
)}
let(:stories) { [story_a, story_b, story_c] }
let(:sprint) { FactoryGirl.create(:sprint, :project => project) }
let(:task) do
task = FactoryGirl.create(:task, :project => project, :status => statuses[0], :fixed_version => sprint, :tracker => tracker_task)
task = FactoryGirl.create(:task, :project => project, :status => statuses[0], :fixed_version => sprint, :type => type_task)
#this is necessary as for some unknown reason passing the parent directly leads to the task searching for
#the parent with 'root_id' is NULL, which is not the case as the story has its own id as root_id
task.parent_id = story_a.id
task
end
let(:impediment) { FactoryGirl.create(:impediment, :project => project, :status => statuses[0], :fixed_version => sprint, :blocks_ids => task.id.to_s, :tracker => tracker_task) }
let(:impediment) { FactoryGirl.create(:impediment, :project => project, :status => statuses[0], :fixed_version => sprint, :blocks_ids => task.id.to_s, :type => type_task) }
before :each do
Setting.plugin_openproject_backlogs = Setting.plugin_openproject_backlogs.merge("task_tracker" => tracker_task.id)
Setting.plugin_openproject_backlogs = Setting.plugin_openproject_backlogs.merge("story_trackers" => [tracker_feature.id])
Setting.plugin_openproject_backlogs = Setting.plugin_openproject_backlogs.merge("task_type" => type_task.id)
Setting.plugin_openproject_backlogs = Setting.plugin_openproject_backlogs.merge("story_types" => [type_feature.id])
view.extend RbCommonHelper
view.extend TaskboardsHelper

Loading…
Cancel
Save