def construct_work(id, title, effort_left_d, prereqs, assignee_id, key_date): result = Work(id) result.title = title result.effort_left_d = effort_left_d result.prereqs = prereqs result.assignee_id = assignee_id result.key_date = key_date return result
def test_schedule(self): timeline = Timeline(util.nov1) work_slot, _ = timeline.find_slot(4, 1.5) w = Work(1) w.title = 'Some work' w.effort_left_d = 1.5 w.assignee_id = 100 w.schedule(work_slot) self.assertEqual(util.nov7, w.est_start_date()) self.assertEqual(util.nov8, w.est_end_date()) return
def fields_to_work_object(fields): result = Work(fields['id']) for f in fields.keys(): if f == 'title': result.title = fields[f] elif f == 'assignee_id' or f == 'person_id': result.assignee_id = fields[f] elif f == 'project_name': result.project_name = fields[f] elif f == 'project_id': result.project_id = fields[f] elif f == 'effort_left_d': result.effort_left_d = float(fields[f]) elif f == 'prereqs': result.prereqs = dovetail.util.condition_prereqs(fields[f]) elif f == 'key_date': result.key_date = dovetail.util.condition_date(fields[f]) elif f == 'start_date': result.start_date = dovetail.util.condition_date(fields[f]) elif f == 'end_date': result.end_date = dovetail.util.condition_date(fields[f]) return result
def test_earliest_start_date(self): timeline = Timeline(util.nov1) work_slot, _ = timeline.find_slot(4, 1.5) w1 = Work(1) w1.title = 'w1' w1.effort_left_d = 1.0 w1.assignee_id = 100 w1.schedule(timeline.find_slot(0, 1)[0]) w2 = Work(2) w2.title = 'w2' w2.effort_left_d = 1.0 w2.assignee_id = 101 w2.schedule(timeline.find_slot(1, 3)[0]) w3 = Work(3) w3.title = 'w3' w3.effort_left_d = 1.0 w3.prereqs = [1, 2] w3.assignee_id = 200 work_dict = {1: w1, 2: w2, 3: w3} self.assertEqual(util.nov7, w3.earliest_start_date(work_dict, util.nov1)) return