Merge lp:~mabac/launchpad-work-items-tracker/support-deferred-cards into lp:~linaro-automation/launchpad-work-items-tracker/linaro

Proposed by Mattias Backman
Status: Merged
Merged at revision: 322
Proposed branch: lp:~mabac/launchpad-work-items-tracker/support-deferred-cards
Merge into: lp:~linaro-automation/launchpad-work-items-tracker/linaro
Diff against target: 110 lines (+44/-34)
2 files modified
collect_roadmap (+40/-34)
lpworkitems/collect_roadmap.py (+4/-0)
To merge this branch: bzr merge lp:~mabac/launchpad-work-items-tracker/support-deferred-cards
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
Review via email: mp+86405@code.launchpad.net

Description of the change

Hi,

This branch adds support for collecting the Deferred lane.

It does this by accepting that there are Cards without status (sub lanes) and only collects cards for Lanes which have been collected. The last part is because of the Legend lane which also have no sub lanes, but we actually ignore that lane before cards are collected.

Thanks,

Mattias

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

Looks good to me: to confirm my understanding, this basically only replaces use of 'task_status is None' when checking if a card needs to be collected by using either task_status['parent_id'] or task['task']['workflow_stage_id'] to check if a lane by that ID is collected instead using the new method lane_is_collected. All the rest is reindentation, afaics, so good to go.

(and oh my, this code does miss tests :)

review: Approve
Revision history for this message
Mattias Backman (mabac) wrote :

On Wed, Dec 21, 2011 at 8:57 AM, Данило Шеган <email address hidden> wrote:
> Review: Approve
>
> Looks good to me: to confirm my understanding, this basically only replaces use of 'task_status is None' when checking if a card needs to be collected by using either task_status['parent_id'] or task['task']['workflow_stage_id'] to check if a lane by that ID is collected instead using the new method lane_is_collected. All the rest is reindentation, afaics, so good to go.

Yes. The previous check made sure that we only collected cards that
where in a sub-lane below a lane. This means that they are in a
"quarter" lane and has a status so we skipped the Legend and Deferred
cards. Since we're supposed to display the Deferred lane, now we just
skip cards that belong to a lane we explicitly ignore.

>
> (and oh my, this code does miss tests :)

Probably is a good time to add those and do TDD from this point on. :)

> --
> https://code.launchpad.net/~mabac/launchpad-work-items-tracker/support-deferred-cards/+merge/86405
> You are the owner of lp:~mabac/launchpad-work-items-tracker/support-deferred-cards.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'collect_roadmap'
2--- collect_roadmap 2011-12-15 18:45:54 +0000
3+++ collect_roadmap 2011-12-20 14:18:03 +0000
4@@ -97,6 +97,7 @@
5 def kanban_import_cards(collector, tasks, status_list, card_types):
6 types_to_ignore = ['Summits']
7 for task in tasks:
8+ dbg("Collecting card '%s'." % (task['task']['name']))
9 status_id = task['task']['workflow_stage_id']
10 assert status_id is not None
11 task_status = None
12@@ -104,44 +105,49 @@
13 if status['id'] == status_id:
14 task_status = status
15 break
16- if task_status is not None:
17- card_type_id = task['task']['card_type_id']
18- card_type_name = None
19- for card_type in card_types:
20- if card_type['id'] == card_type_id:
21- card_type_name = card_type['name']
22- break
23- else:
24- dbg("Cannot find type for card '%s'." % (task['task']['name']))
25- if card_type_name in types_to_ignore:
26- dbg("Ignoring card '%s' since it\'s type is '%s'." % \
27- (task['task']['name'], card_type['name']))
28- else:
29+ card_type_id = task['task']['card_type_id']
30+ card_type_name = None
31+ for card_type in card_types:
32+ if card_type['id'] == card_type_id:
33+ card_type_name = card_type['name']
34+ break
35+ else:
36+ dbg("Cannot find type for card '%s'." % (task['task']['name']))
37+ if card_type_name in types_to_ignore:
38+ dbg("Ignoring card '%s' since it\'s type is '%s'." % \
39+ (task['task']['name'], card_type['name']))
40+ else:
41+ if task_status is not None:
42 lane_id = task_status['parent_id']
43 assert lane_id is not None
44- model_card = Card(get_json_item(task['task'], 'name'),
45- task['task']['id'], lane_id,
46- get_json_item(task['task'], 'external_id'))
47+ else:
48+ lane_id = status_id
49+ if not collector.lane_is_collected(lane_id):
50+ dbg("Ignoring card '%s' since it\'s Lane is ignored." % \
51+ (task['task']['name']))
52+ continue
53+ model_card = Card(get_json_item(task['task'], 'name'),
54+ task['task']['id'], lane_id,
55+ get_json_item(task['task'], 'external_id'))
56+ if task_status is not None:
57 model_card.status = get_json_item(task_status, 'name')
58- model_card.team = unicode_or_None(card_type_name)
59- model_card.priority = lookup_kanban_priority(
60- task['task']['priority'])
61- model_card.size = get_json_item(task['task'], 'size_estimate')
62- model_card.sponsor = get_json_item(task['task'],
63- 'custom_field_1')
64+ model_card.team = unicode_or_None(card_type_name)
65+ model_card.priority = lookup_kanban_priority(
66+ task['task']['priority'])
67+ model_card.size = get_json_item(task['task'], 'size_estimate')
68+ model_card.sponsor = get_json_item(task['task'],
69+ 'custom_field_1')
70
71- external_link = task['task']['external_link']
72- if external_link is not None and external_link is not '':
73- model_card.url = unicode_or_None(external_link)
74- dbg('Getting Papyrs information from %s.' % external_link)
75- papyrs_data = papyrs_import(collector, external_link)
76- model_card.description = get_json_item(papyrs_data,
77- 'description')
78- model_card.acceptance_criteria = get_json_item(
79- papyrs_data, 'acceptance_criteria')
80- collector.store_card(model_card)
81- else:
82- dbg("Task '%s' does not have a status." % task['task']['name'])
83+ external_link = task['task']['external_link']
84+ if external_link is not None and external_link is not '':
85+ model_card.url = unicode_or_None(external_link)
86+ dbg('Getting Papyrs information from %s.' % external_link)
87+ papyrs_data = papyrs_import(collector, external_link)
88+ model_card.description = get_json_item(papyrs_data,
89+ 'description')
90+ model_card.acceptance_criteria = get_json_item(
91+ papyrs_data, 'acceptance_criteria')
92+ collector.store_card(model_card)
93
94
95 def kanban_import(collector, cfg, board_id, api_token):
96
97=== modified file 'lpworkitems/collect_roadmap.py'
98--- lpworkitems/collect_roadmap.py 2011-12-15 18:36:07 +0000
99+++ lpworkitems/collect_roadmap.py 2011-12-20 14:18:03 +0000
100@@ -50,6 +50,10 @@
101 obj.count = count
102 self.store.add(obj)
103
104+ def lane_is_collected(self, lane_id):
105+ return self.store.find(models_roadmap.Lane, models_roadmap.
106+ Lane.lane_id == lane_id).one() is not None
107+
108
109 def get_json_item(data, item_name):
110 item = data[item_name]

Subscribers

People subscribed via source and target branches