Skip to content

Commit

Permalink
When rendering the 'recently logged' area, omit items that already ap…
Browse files Browse the repository at this point in the history
…pear elsewhere in the non-icebox portions of the report. ie. items that are already scheduled.
  • Loading branch information
tlianza committed May 27, 2013
1 parent 71e0d72 commit 03e8a62
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
22 changes: 15 additions & 7 deletions default.rb
Expand Up @@ -93,6 +93,10 @@
@backlog_stories = Array.new
@icebox = Array.new

# Used to weed stories out of the list to-be prioritized because
# we know they're already on the schedule.
@scheduled_story_ids = Set.new

params[:projects].split(',').uniq.each do |project|

#Work done in last iteration
Expand All @@ -105,6 +109,7 @@
@done_stories << story
@done_points += story.estimate
end
@scheduled_story_ids.add(story.story_id)
end
end

Expand All @@ -119,22 +124,25 @@
@current_stories << story
@current_points += story.estimate
end
@scheduled_story_ids.add(story.story_id)
end
end


#Grab the rest of the backlog
if include_backlog
@backlog_stories = parse_stories_from_iterations(iterations(project, params[:api_key], 3, 1))
@backlog_stories.each { |story| @scheduled_story_ids.add(story.story_id) }
end

#Grab the recently logged stories
begin
doc = Nokogiri::HTML(created_since(@start_date, project, params[:api_key], 'state:unscheduled'))
doc.xpath('//stories//story').each do |s|
@recently_logged_stories << Story.new.from_xml(s)
story = Story.new.from_xml(s)
@recently_logged_stories << story unless @scheduled_story_ids.include?(story.story_id)
end
end

#Grab the rest of the backlog
if include_backlog
@backlog_stories = parse_stories_from_iterations(iterations(project, params[:api_key], 3, 1))
end

#Grab the icebox
if(include_icebox)
doc = Nokogiri::HTML(icebox(project, params[:api_key]))
Expand Down
8 changes: 4 additions & 4 deletions models/story.rb
@@ -1,11 +1,11 @@

class Story
attr_reader :id, :title, :description, :url, :accepted_at, :requested_by, :owned_by, :created_at, :story_type, :current_state, :estimate, :updated_at, :labels
attr_reader :story_id, :title, :description, :url, :accepted_at, :requested_by, :owned_by, :created_at, :story_type, :current_state, :estimate, :updated_at, :labels
attr_accessor :estimated_date

# Builds a story given an XML node from pivotal tracker
def from_xml(node)
@id = node.xpath('id')[0].content
@story_id = node.xpath('id')[0].content
@title = node.xpath('name')[0].content
@description = node.xpath('description')[0].content unless node.xpath('description')[0].nil?
@url = node.xpath('url')[0].content
Expand Down Expand Up @@ -61,12 +61,12 @@ def self.top_labels(story_array, limit=3)
story_array.each { |story|
if story.labels.nil?
@labels['z_uncategorized'] = Array.new unless @labels.has_key?('z_uncategorized')
@labels['z_uncategorized'] << story.id
@labels['z_uncategorized'] << story.story_id
@label_weights['z_uncategorized'] +=1
else
story.labels.each do |l|
@labels[l] = Array.new unless @labels.has_key?(l)
@labels[l] << story.id
@labels[l] << story.story_id
@label_weights[l] += 1.to_f/story.labels.count
end
end
Expand Down

0 comments on commit 03e8a62

Please sign in to comment.