[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#797633: Add more context to wnpp action item short description.



Package: tracker.debian.org
Severity: minor

Hi,

When a package has a WNPP bug filed about it, the action item
displayed currently only shows the acronym. So orphaned packages, for
instance, simply show:

    O

Without more information, any user unfamiliar with the terminology
would have no idea idea what it means. The attached patch would change
it to:

    O: This package has been orphaned and needs a maintainer.


Thanks,

-- Andrew Starr-Bochicchio

   Ubuntu Developer <https://launchpad.net/~andrewsomething>
   Debian Developer <http://qa.debian.org/developer.php?login=asb>
   PGP/GPG Key ID: D53FDCB1
From 94cf452350d512444c8a35f4ab6443706502b2f2 Mon Sep 17 00:00:00 2001
From: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
Date: Mon, 31 Aug 2015 22:02:10 -0400
Subject: [PATCH] Add more context to wnpp action item short description.

---
 distro_tracker/vendor/debian/tests.py         | 41 +++++++++++++++++++++++++++
 distro_tracker/vendor/debian/tracker_tasks.py | 19 +++++++++++--
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/distro_tracker/vendor/debian/tests.py b/distro_tracker/vendor/debian/tests.py
index 0b563ac..52e8348 100644
--- a/distro_tracker/vendor/debian/tests.py
+++ b/distro_tracker/vendor/debian/tests.py
@@ -4034,6 +4034,47 @@ class UpdateWnppStatsTaskTests(TestCase):
             'bug_id': bug_id,
         }
         self.assertEqual(expected_data, item.extra_data['wnpp_info'])
+        # Test that the short description is correctly set.
+        dsc = ('<a href="https://bugs.debian.org/12345";>O: This package has'
+               ' been orphaned and needs a maintainer.</a>')
+        self.assertEqual(dsc, item.short_description)
+
+    def test_action_item_created_unknown_type(self):
+        """
+        Tests that an :class:`ActionItem
+        <distro_tracker.core.models.ActionItem>` instance is created when the
+        package has a WNPP bug of an unknown type.
+        """
+        wnpp_type, bug_id = 'RFC', 12345
+        self.set_wnpp_content([(
+            self.package.name, [{
+                'wnpp_type': wnpp_type,
+                'bug_id': bug_id,
+            }]
+        )])
+
+        self.run_task()
+
+        # An action item has been created
+        self.assertEqual(1, ActionItem.objects.count())
+        # The item has the correct type and template
+        item = ActionItem.objects.all()[0]
+        self.assertEqual(
+            UpdateWnppStatsTask.ACTION_ITEM_TYPE_NAME,
+            item.item_type.type_name)
+        self.assertEqual(
+            UpdateWnppStatsTask.ACTION_ITEM_TEMPLATE,
+            item.full_description_template)
+        # The extra data is correctly set?
+        expected_data = {
+            'wnpp_type': wnpp_type,
+            'bug_id': bug_id,
+        }
+        self.assertEqual(expected_data, item.extra_data['wnpp_info'])
+        # Test that the short description is correctly set.
+        dsc = ('<a href="https://bugs.debian.org/12345";>RFC: The WNPP database'
+               ' contains an entry for this package.</a>')
+        self.assertEqual(dsc, item.short_description)
 
     def test_action_item_updated(self):
         """
diff --git a/distro_tracker/vendor/debian/tracker_tasks.py b/distro_tracker/vendor/debian/tracker_tasks.py
index 8390d75..fc41adf 100644
--- a/distro_tracker/vendor/debian/tracker_tasks.py
+++ b/distro_tracker/vendor/debian/tracker_tasks.py
@@ -1947,7 +1947,7 @@ class UpdateWnppStatsTask(BaseTask):
     """
     ACTION_ITEM_TYPE_NAME = 'debian-wnpp-issue'
     ACTION_ITEM_TEMPLATE = 'debian/wnpp-action-item.html'
-    ITEM_DESCRIPTION = '<a href="{url}">{wnpp_type}</a>'
+    ITEM_DESCRIPTION = '<a href="{url}">{wnpp_type}: {wnpp_msg}</a>'
 
     def __init__(self, force_update=False, *args, **kwargs):
         super(UpdateWnppStatsTask, self).__init__(*args, **kwargs)
@@ -2024,9 +2024,24 @@ class UpdateWnppStatsTask(BaseTask):
                 package.main_entry.repository.codename
         except:
             release = None
+
+        msgs = { 'O': "This package has been orphaned and needs a maintainer.",
+            'ITA': "Someone intends to adopt this package.",
+            'RFA': "The maintainer is looking for someone adopt this package.",
+            'RFH': "The maintainer is looking for help with this package.",
+            'ITP': "Someone is planning to reintroduce this package.",
+            'RFP': "There is a request to reintroduced this package.",
+            'RM': "This package has been requested to be removed.",
+            '?': "The WNPP database contains an entry for this package."}
+        wnpp_type = stats['wnpp_type']
+        try:
+            wnpp_msg = msgs[wnpp_type]
+        except KeyError:
+            wnpp_msg = msgs['?']
+
         action_item.short_description = self.ITEM_DESCRIPTION.format(
             url='https://bugs.debian.org/{}'.format(stats['bug_id']),
-            wnpp_type=stats['wnpp_type'])
+            wnpp_type=wnpp_type, wnpp_msg=wnpp_msg)
         action_item.extra_data = {
             'wnpp_info': stats,
             'release': release,
-- 
2.1.4


Reply to: