about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/jitterbug.pm16
-rw-r--r--views/index.tt4
2 files changed, 13 insertions, 7 deletions
diff --git a/lib/jitterbug.pm b/lib/jitterbug.pm
index 0d27a85..bcf3326 100644
--- a/lib/jitterbug.pm
+++ b/lib/jitterbug.pm
@@ -19,16 +19,20 @@ get '/' => sub {
     foreach (@proj_name) {
         my $proj = redis->get( key_project($_) );
         next unless $proj;
-        debug("on a $proj");
         my $desc = from_json($proj);
         my @ids  = redis->smembers( key_builds_project($_) );
-        if(@ids) {
+        my $last_build;
+        if (!@ids) {
             my $res = redis->get( pop @ids );
-              if ($res) {
-                my $last_build = from_json($res);
-                $desc->{last_build} = $last_build;
+            if ($res) {
+                $last_build = from_json($res);
             }
-        } push @projects, $desc;
+        }
+        else {
+            $last_build = { timestamp => '' };
+        }
+        $desc->{last_build} = $last_build;
+        push @projects, $desc;
     }
 
     @projects =
diff --git a/views/index.tt b/views/index.tt
index afebb93..f763aff 100644
--- a/views/index.tt
+++ b/views/index.tt
@@ -13,7 +13,9 @@
             <h3><a href="<: $uri_base :>project/<: $project.name :>"><: $project.name :></a></h3>
             <div class="repo-body">
               <p class="desc"><: $project.description :></p>
-              <p class="updated-at">last updated at <: $project.last_build.timestamp :></p>
+              :if $project.last_build.timestamp {
+                <p class="updated-at">last updated at <: $project.last_build.timestamp :></p>
+              :}
               <div class="last-builds">
                 :for $project.last_build.version.keys() -> $version {
                   <a href="<: $uri_base :>/api/build/<: $project.name :>/<: $project.last_build.commit :>/<: $version :>"><: $version :></a> <span class="<: $project.last_build.version[$version] :>"><: $project.last_build.version[$version] :></span>