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
=== modified file 'collect_roadmap'
--- collect_roadmap 2011-12-15 18:45:54 +0000
+++ collect_roadmap 2011-12-20 14:18:03 +0000
@@ -97,6 +97,7 @@
97def kanban_import_cards(collector, tasks, status_list, card_types):97def kanban_import_cards(collector, tasks, status_list, card_types):
98 types_to_ignore = ['Summits']98 types_to_ignore = ['Summits']
99 for task in tasks:99 for task in tasks:
100 dbg("Collecting card '%s'." % (task['task']['name']))
100 status_id = task['task']['workflow_stage_id']101 status_id = task['task']['workflow_stage_id']
101 assert status_id is not None102 assert status_id is not None
102 task_status = None103 task_status = None
@@ -104,44 +105,49 @@
104 if status['id'] == status_id:105 if status['id'] == status_id:
105 task_status = status106 task_status = status
106 break107 break
107 if task_status is not None:108 card_type_id = task['task']['card_type_id']
108 card_type_id = task['task']['card_type_id']109 card_type_name = None
109 card_type_name = None110 for card_type in card_types:
110 for card_type in card_types:111 if card_type['id'] == card_type_id:
111 if card_type['id'] == card_type_id:112 card_type_name = card_type['name']
112 card_type_name = card_type['name']113 break
113 break114 else:
114 else:115 dbg("Cannot find type for card '%s'." % (task['task']['name']))
115 dbg("Cannot find type for card '%s'." % (task['task']['name']))116 if card_type_name in types_to_ignore:
116 if card_type_name in types_to_ignore:117 dbg("Ignoring card '%s' since it\'s type is '%s'." % \
117 dbg("Ignoring card '%s' since it\'s type is '%s'." % \118 (task['task']['name'], card_type['name']))
118 (task['task']['name'], card_type['name']))119 else:
119 else:120 if task_status is not None:
120 lane_id = task_status['parent_id']121 lane_id = task_status['parent_id']
121 assert lane_id is not None122 assert lane_id is not None
122 model_card = Card(get_json_item(task['task'], 'name'),123 else:
123 task['task']['id'], lane_id,124 lane_id = status_id
124 get_json_item(task['task'], 'external_id'))125 if not collector.lane_is_collected(lane_id):
126 dbg("Ignoring card '%s' since it\'s Lane is ignored." % \
127 (task['task']['name']))
128 continue
129 model_card = Card(get_json_item(task['task'], 'name'),
130 task['task']['id'], lane_id,
131 get_json_item(task['task'], 'external_id'))
132 if task_status is not None:
125 model_card.status = get_json_item(task_status, 'name')133 model_card.status = get_json_item(task_status, 'name')
126 model_card.team = unicode_or_None(card_type_name)134 model_card.team = unicode_or_None(card_type_name)
127 model_card.priority = lookup_kanban_priority(135 model_card.priority = lookup_kanban_priority(
128 task['task']['priority'])136 task['task']['priority'])
129 model_card.size = get_json_item(task['task'], 'size_estimate')137 model_card.size = get_json_item(task['task'], 'size_estimate')
130 model_card.sponsor = get_json_item(task['task'],138 model_card.sponsor = get_json_item(task['task'],
131 'custom_field_1')139 'custom_field_1')
132140
133 external_link = task['task']['external_link']141 external_link = task['task']['external_link']
134 if external_link is not None and external_link is not '':142 if external_link is not None and external_link is not '':
135 model_card.url = unicode_or_None(external_link)143 model_card.url = unicode_or_None(external_link)
136 dbg('Getting Papyrs information from %s.' % external_link)144 dbg('Getting Papyrs information from %s.' % external_link)
137 papyrs_data = papyrs_import(collector, external_link)145 papyrs_data = papyrs_import(collector, external_link)
138 model_card.description = get_json_item(papyrs_data,146 model_card.description = get_json_item(papyrs_data,
139 'description')147 'description')
140 model_card.acceptance_criteria = get_json_item(148 model_card.acceptance_criteria = get_json_item(
141 papyrs_data, 'acceptance_criteria')149 papyrs_data, 'acceptance_criteria')
142 collector.store_card(model_card)150 collector.store_card(model_card)
143 else:
144 dbg("Task '%s' does not have a status." % task['task']['name'])
145151
146152
147def kanban_import(collector, cfg, board_id, api_token):153def kanban_import(collector, cfg, board_id, api_token):
148154
=== modified file 'lpworkitems/collect_roadmap.py'
--- lpworkitems/collect_roadmap.py 2011-12-15 18:36:07 +0000
+++ lpworkitems/collect_roadmap.py 2011-12-20 14:18:03 +0000
@@ -50,6 +50,10 @@
50 obj.count = count50 obj.count = count
51 self.store.add(obj)51 self.store.add(obj)
5252
53 def lane_is_collected(self, lane_id):
54 return self.store.find(models_roadmap.Lane, models_roadmap.
55 Lane.lane_id == lane_id).one() is not None
56
5357
54def get_json_item(data, item_name):58def get_json_item(data, item_name):
55 item = data[item_name]59 item = data[item_name]

Subscribers

People subscribed via source and target branches