class Estimate::Project

Constants

WORK_WEEK_DAYS

Public Class Methods

new(name, properties={}) click to toggle source
# File lib/estimate/project.rb, line 6
def initialize name, properties={}
  @name = name
  @properties = properties
end

Public Instance Methods

process!() click to toggle source
# File lib/estimate/project.rb, line 11
  def process!
"""
Project: #{@name}
Incomplete stories: #{incomplete_stories.length}

And your project end date is.....
          #{display_end_date}

You have #{remaining_days} days to complete this project.
"""
  end

Private Instance Methods

day_points() click to toggle source
# File lib/estimate/project.rb, line 61
def day_points
  @properties[:day_points] || 1
end
developers() click to toggle source
# File lib/estimate/project.rb, line 69
def developers
  @properties[:developers] || 2
end
display_end_date() click to toggle source
# File lib/estimate/project.rb, line 45
def display_end_date
  end_date.strftime('%A, %b %d %Y')
end
end_date() click to toggle source
# File lib/estimate/project.rb, line 49
def end_date
  DateTime.now + remaining_weeks*7
end
holidays() click to toggle source
# File lib/estimate/project.rb, line 65
def holidays
  5*developers
end
incomplete_stati() click to toggle source
# File lib/estimate/project.rb, line 41
def incomplete_stati
  [ 'unscheduled', 'unstarted', 'started' ]
end
incomplete_stories() click to toggle source
# File lib/estimate/project.rb, line 26
def incomplete_stories
  @stories = @stories || project.stories.all(:story_type => story_points.keys, :current_state => incomplete_stati)
end
points() click to toggle source
# File lib/estimate/project.rb, line 57
def points
  incomplete_stories.inject(0) { |points, story|  points + story_points[story.story_type.to_sym] }
end
project() click to toggle source
# File lib/estimate/project.rb, line 30
def project
  @project = @project || PivotalTracker::Project.all.select { |x| x.name.eql? @name }.first
end
remaining_days() click to toggle source
# File lib/estimate/project.rb, line 73
def remaining_days
  (end_date-DateTime.now).to_i
end
remaining_weeks() click to toggle source
# File lib/estimate/project.rb, line 53
def remaining_weeks
  @remaining_weeks = @remaining_weeks || (points/day_points+holidays*developers)/WORK_WEEK_DAYS/developers
end
story_points() click to toggle source
# File lib/estimate/project.rb, line 34
def story_points
  { :feature => 5,
    :bug => 1,
    :chore => 1
  }
end