Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Story follows task status - additional option. #1037

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion app/models/rb_story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,15 @@ def list_with_gaps_scope_condition(options={})
end

def story_follow_task_state
return if Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'close' && Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'loose'
return if Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'close' &&
Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'loose' &&
Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'inprogress'
return if self.status.is_closed? #bail out if we are closed

self.reload #we might be stale at this point
case Setting.plugin_redmine_backlogs[:story_follow_task_status]
when 'inprogress'
set_story_status_if_following_to_close_or_to_in_progress
when 'close'
set_closed_status_if_following_to_close
when 'loose'
Expand Down Expand Up @@ -434,6 +438,19 @@ def set_closed_status_if_following_to_close
end
end

def set_story_status_if_following_to_close_or_to_in_progress
resolved_status_id = 3
in_progress_status_id = 2

tasks.each{|task|
self.journalized_update_attributes :status_id => in_progress_status_id unless task.status.is_default?
}
tasks.each{|task|
return unless task.status.is_closed?
}
self.journalized_update_attributes :status_id => resolved_status_id #update, but no need to position
end

private

def calc_total_auto(p,days,in_release_first)
Expand Down
3 changes: 3 additions & 0 deletions app/views/backlogs/_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@
<%= radio_button_tag("settings[story_follow_task_status]", 'close',
Backlogs.setting[:story_follow_task_status] == 'close' ) %><%= l(:backlogs_story_follow_task_status_close) %>
<br />
<%= radio_button_tag("settings[story_follow_task_status]", 'inprogress',
Backlogs.setting[:story_follow_task_status] == 'inprogress' ) %><%= "Resolved when all Tasks are closed.\n In Progress when even one Task is not new." %>
<br />
<%= radio_button_tag("settings[story_follow_task_status]", 'loose',
Backlogs.setting[:story_follow_task_status] == 'loose' ) %><%= l(:backlogs_story_follow_task_status_loose) %>
<span id="settings_story_follow_task_status_explanation" style="display:block;margin-left:12px"><%= l(:backlogs_story_follows_task_loose_explanation) %></span>
Expand Down