]> git.donarmstrong.com Git - debbugs.git/commitdiff
- Indicate date of last activity (closes: #207065)
authorDon Armstrong <don@donarmstrong.com>
Thu, 14 Jun 2007 12:49:23 +0000 (13:49 +0100)
committerDon Armstrong <don@donarmstrong.com>
Thu, 14 Jun 2007 12:49:23 +0000 (13:49 +0100)
Debbugs/Common.pm
Debbugs/Status.pm
cgi/pkgreport.cgi
debian/changelog

index 9776392eef2c7fc307f4fc442a18c233d46a4f15..60e2c3092adbb312dba3bc7c516fca748671ed4e 100644 (file)
@@ -43,11 +43,12 @@ BEGIN{
                                qw(getmaintainers_reverse)
                               ],
                     misc   => [qw(make_list)],
+                    date   => [qw(secs_to_english)],
                     quit   => [qw(quit)],
                     lock   => [qw(filelock unfilelock @cleanups)],
                    );
      @EXPORT_OK = ();
-     Exporter::export_ok_tags(qw(lock quit util misc));
+     Exporter::export_ok_tags(qw(lock quit date util misc));
      $EXPORT_TAGS{all} = [@EXPORT_OK];
 }
 
@@ -239,6 +240,32 @@ sub getmaintainers_reverse{
      return $_maintainer_rev;
 }
 
+=head1 DATE
+
+    my $english = secs_to_english($seconds);
+    my ($days,$english) = secs_to_english($seconds);
+
+XXX This should probably be changed to use Date::Calc
+
+=cut
+
+sub secs_to_english{
+     my ($seconds) = @_;
+
+     my $days = int($seconds / 86400);
+     my $years = int($days / 365);
+     $days -= $years * 365;
+     my $result;
+     my @age;
+     push @age, "1 year" if ($years == 1);
+     push @age, "$years years" if ($years > 1);
+     push @age, "1 day" if ($days == 1);
+     push @age, "$days days" if ($days > 1);
+     $result .= join(" and ", @age);
+
+     return wantarray?($days,$result):$result;
+}
+
 
 =head1 LOCK
 
index 5fb5413dcdb3fb1a1e3323ec29a9b45d77da6a4c..bda64abdeef4d9aeca2b0e6de1382ec116f56b73 100644 (file)
@@ -159,6 +159,7 @@ sub read_bug{
     die "One of bug or summary must be passed to read_bug"
         if not exists $param{bug} and not exists $param{summary};
     my $status;
+    my $log;
     if (not defined $param{summary}) {
         my ($lref, $location) = @param{qw(bug location)};
         if (not defined $location) {
@@ -166,6 +167,7 @@ sub read_bug{
              return undef if not defined $location;
         }
         $status = getbugcomponent($lref, 'summary', $location);
+        $log    = getbugcomponent($lref, 'log'    , $location);
         return undef unless defined $status;
     }
     else {
@@ -216,6 +218,8 @@ sub read_bug{
            $data{$field} = decode_rfc1522($data{$field});
        }
     }
+    # Add log last modified time
+    $data{log_modified} = (stat($log))[9];
 
     return \%data;
 }
index 7f16855b704c739b1cfabac536a6f02f45897f36..ad4d2883b1b60f05a2d715ef7eeb385cf6646317 100755 (executable)
@@ -10,7 +10,7 @@ require './common.pl';
 use Debbugs::Config qw(:globals :text);
 use Debbugs::User;
 use Debbugs::CGI qw(version_url);
-use Debbugs::Common qw(getparsedaddrs);
+use Debbugs::Common qw(getparsedaddrs :date);
 use Debbugs::Bugs qw(get_bugs);
 
 use vars qw($gPackagePages $gWebDomain %gSeverityDisplay @gSeverityList);
@@ -647,27 +647,30 @@ sub pkg_htmlindexentrystatus {
                              split /[,\s]+/,$status{forwarded}
                             );
         }
-        my $daysold = int((time - $status{date}) / 86400);   # seconds to days
-        if ($daysold >= 7) {
+       # Check the age of the logfile
+       my ($days_last,$eng_last) = secs_to_english(time - $status{log_modified});
+        my ($days,$eng) = secs_to_english(time - $status{date});
+       
+        if ($days >= 7) {
             my $font = "";
             my $efont = "";
-            $font = "em" if ($daysold > 30);
-            $font = "strong" if ($daysold > 60);
+            $font = "em" if ($days > 30);
+            $font = "strong" if ($days > 60);
             $efont = "</$font>" if ($font);
             $font = "<$font>" if ($font);
 
-            my $yearsold = int($daysold / 365);
-            $daysold -= $yearsold * 365;
-
-            $result .= ";\n $font";
-            my @age;
-            push @age, "1 year" if ($yearsold == 1);
-            push @age, "$yearsold years" if ($yearsold > 1);
-            push @age, "1 day" if ($daysold == 1);
-            push @age, "$daysold days" if ($daysold > 1);
-            $result .= join(" and ", @age);
-            $result .= " old$efont";
+            $result .= ";\n ${font}$eng old$efont";
         }
+       if ($days_last > 7) {
+           my $font = "";
+            my $efont = "";
+            $font = "em" if ($days_last > 30);
+            $font = "strong" if ($days_last > 60);
+            $efont = "</$font>" if ($font);
+            $font = "<$font>" if ($font);
+
+            $result .= ";\n ${font}Modified $eng_last ago$efont";
+       }
     }
 
     $result .= ".";
index 6ccafaa3966a97cc0cbe8498cc700b4ec4bb01a5..101666f53e877f84577623a91e2c0f1dd4e65673 100644 (file)
@@ -184,6 +184,7 @@ debbugs (2.4.2) UNRELEASED; urgency=low
     - Split out packages so that you don't have to install the mail stuff
       unless you want it.
     - Only mail duplicated recipients once (closes: #172635)
+    - Indicate date of last activity (closes: #207065)
 
   
  -- Colin Watson <cjwatson@debian.org>  Fri, 20 Jun 2003 18:57:25 +0100