require "pivotal_tracker"

module Stagehand
  module Helpers
    def stagehand_hud
      render :partial => "stagehand/hud"
    end

    def project
      PivotalTracker::Project.find(Stagehand.project_id)
    end

    def active_story
      project.stories.find(active_id)
    end

    def active_id
      Stagehand.redis.get("stagehand")
    end

    def finished_stories
      project.stories.all(state: "finished").sort_by(&:name)
    end

    def is_active?(story)
      story.id.to_s == active_id.to_s
    end
  end
end
