Class: WhoIsSlacking::Start

Inherits:
Object
  • Object
show all
Defined in:
lib/whois_slacking.rb

Class Method Summary collapse

Class Method Details

.nowObject

whois-slacking – get project name – get slack channel – get all users for the project – save tasks

-- retrieve all tasks from pivotal for the project
-- loop through tasks
-- if task/username combo does not exist in db
  -- save project/task/user 
  -- save when task was started
  -- save who started task
  -- if task is not-completed in pivotal
    -- save status as status not-completed
    -- publish message task/user started today
      -- "Today Johnny started 'As a user I should be able to log in'"
  -- if task is completed in pivotal
    -- save status as status completed
    -- publish message task/user started today
      -- "Today Johnny completed 'As a user I should be able to log in'"
-- if task/username combo exists and is not completed in db
  -- calculate how long (realtime) the task has been worked on in days (.5, 1.5 etc)
  -- update time on task
  -- save who started task
  -- publish message task/user/how long to slack 
    -- "Johnny has spent 2 days working on 'As a user I should be able to log in'"

– pruning

-- retrieve all tasks from db for the project
-- retrieve all tasks from pivotal for the project
-- loop through all tasks from db
  -- if task/user name combo does not exist in pivotal
    -- mark task/user name combo in db as deleted
      -- "Today Johnny gave up working on 'As a user I should be able to log in'"
  -- if task/user name combo is completed in pivotal but not completed in db
    -- mark task/user name combo in db as completed
      -- "Today Johnny completed 'As a user I should be able to log in'"


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/whois_slacking.rb', line 52

def self.now 
  WhoIsSlacking::Pivotal.connect_to_pivotal
  project_object = WhoIsSlacking::Pivotal
    .pivotal_project( WhoIsSlacking::Pivotal.project_name)
  tasks = WhoIsSlacking::Pivotal.project_stories(project_object) 
  tasks.each do |task|
    if task.current_state != 'unstarted' && 
        task.owned_by && 
        task.current_state != 'restart' &&
        task.current_state != 'unestimated' &&
        task.current_state != 'unscheduled' &&
        task.current_state != 'accepted' 
      WhoIsSlacking::DataTools.save_task(project_object.name, task.id, task.name, task.owned_by, task.current_state, task.accepted_at, task.url )
    end
  end
end