← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/branch-approximatedate into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/branch-approximatedate into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/branch-approximatedate/+merge/66480

Change how dates for branches are displayed. This took far too long to sort out, but there are two properties in branchlisting called since_created and since_updated. They return a duration which was then formatted as a duration -- and the duration formatter maxed out at weeks, so branches would show 'Last modified: 163 weeks ago'.

I have ripped them out, and switched to the dates themselves, which will show approximate dates, such as 'Last modified: 2 years ago'.

I am a little unhappy that there are no tests, but I have checked the TAL, and it works fine on my local machine.
-- 
https://code.launchpad.net/~stevenk/launchpad/branch-approximatedate/+merge/66480
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/branch-approximatedate into lp:launchpad.
=== modified file 'lib/lp/code/browser/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py	2011-06-27 15:14:46 +0000
+++ lib/lp/code/browser/branchlisting.py	2011-06-30 15:43:46 +0000
@@ -216,16 +216,6 @@
         return [series for series in self.associated_product_series
                 if series.status != SeriesStatus.OBSOLETE]
 
-    @property
-    def since_updated(self):
-        """How long since the branch was last updated."""
-        return self._now - self.context.date_last_modified
-
-    @property
-    def since_created(self):
-        """How long since the branch was created."""
-        return self._now - self.context.date_created
-
     def isBugBadgeVisible(self):
         return self.show_bug_badge
 

=== modified file 'lib/lp/code/templates/branch-listing.pt'
--- lib/lp/code/templates/branch-listing.pt	2011-02-09 00:29:50 +0000
+++ lib/lp/code/templates/branch-listing.pt	2011-06-30 15:43:46 +0000
@@ -119,9 +119,9 @@
             2005-02-12 13:45 EST
           </span>
           <span tal:attributes="title branch/date_created/fmt:datetime"
-                tal:content="branch/since_created/fmt:approximateduration/use-digits">
+                tal:content="branch/date_created/fmt:approximatedate">
             sometime
-            </span> ago
+            </span>
         </td>
         <td tal:condition="context/show_column/product|nothing">
           <a tal:condition="branch/product"
@@ -137,9 +137,9 @@
             2005-02-12 13:45 EST
           </span>
           <span tal:attributes="title branch/date_last_modified/fmt:datetime"
-                tal:content="branch/since_updated/fmt:approximateduration/use-digits">
+                tal:content="branch/date_last_modified/fmt:approximatedate">
             sometime
-          </span> ago
+          </span>
         </td>
 
         <tal:no_commit condition="not: branch/last_commit">

=== modified file 'lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt'
--- lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt	2011-06-29 15:06:32 +0000
+++ lib/lp/code/templates/distributionsourcepackage-branches-grouped.pt	2011-06-30 15:43:46 +0000
@@ -69,7 +69,7 @@
           </td>
           <td>
             <span tal:attributes="title branch/date_last_modified/fmt:datetime"
-                  tal:content="branch/since_updated/fmt:approximateduration/use-digits">
+                  tal:content="branch/date_last_updated/fmt:approximatedate">
               sometime
               </span> ago
           </td>


Follow ups