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

V1.0.6 task update optimization #1096

Open
wants to merge 2 commits 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions app/models/rb_issue_history.rb
Expand Up @@ -88,11 +88,14 @@ def filter_release(days)
end

def self.issue_type(tracker_id)
return nil if tracker_id.nil? || tracker_id == ''
tracker_id = tracker_id.to_i
return :story if RbStory.trackers && RbStory.trackers.include?(tracker_id)
return :task if tracker_id == RbTask.tracker
return nil
return nil if tracker_id.blank?
if RbStory.trackers_include?(tracker_id)
:story
elsif RbTask.tracker?(tracker_id)
:task
else
nil
end
end

def expand
Expand Down
6 changes: 6 additions & 0 deletions app/models/rb_story.rb
Expand Up @@ -203,6 +203,12 @@ def self.trackers(options = {})
end
end

def self.trackers_include?(tracker_id)
tracker_ids = Backlogs.setting[:story_trackers] || []
tracker_ids = tracker_ids.map(&:to_i)
tracker_ids.include?(tracker_id.to_i)
end

def self.has_settings_table
ActiveRecord::Base.connection.tables.include?('settings')
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/rb_task.rb
Expand Up @@ -9,6 +9,10 @@ def self.tracker
return Integer(task_tracker)
end

def self.tracker?(tracker_id)
self.tracker == tracker_id.to_i
end

# unify api between story and task. FIXME: remove this when merging to tracker-free-tasks
# required for RbServerVariablesHelper.workflow_transitions
def self.trackers
Expand Down
4 changes: 2 additions & 2 deletions lib/backlogs_issue_patch.rb
Expand Up @@ -41,11 +41,11 @@ def release_burnchart_day_caches(release_id)
end

def is_story?
return RbStory.trackers.include?(tracker_id)
RbStory.trackers_include?(tracker_id)
end

def is_task?
return (tracker_id == RbTask.tracker)
RbTask.tracker?(tracker_id)
end

def story
Expand Down