From 71010ff6819695a4e771dad68da2511597d57835 Mon Sep 17 00:00:00 2001 From: lukemelia Date: Sun, 4 Nov 2007 23:23:35 +0000 Subject: [PATCH] Fixed #593, where the stats page failed to render if the user has no actions. Thanks to SK for the bug report. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@629 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/views/stats/_totals.rhtml | 7 ++++++- tracks/app/views/stats/index.rhtml | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tracks/app/views/stats/_totals.rhtml b/tracks/app/views/stats/_totals.rhtml index 3abed60f..806342c6 100755 --- a/tracks/app/views/stats/_totals.rhtml +++ b/tracks/app/views/stats/_totals.rhtml @@ -7,11 +7,16 @@ Of those <%= @contexts.count(:conditions => ["hide = ?", false])%> are visible contexts and <%= @contexts.count(:conditions => ["hide = ?", true]) %> are hidden contexts +<% unless @actions.count == 0 -%>

You have <%= @actions.count(:conditions => "completed_at IS NULL") %> uncompleted actions of which <%= @actions.count(:conditions => "completed_at IS NULL AND NOT show_from IS NULL") %> are deferred actions.

+

Since your first action on <%= format_date(@first_action.created_at) %> you have a total of <%= @actions.count %> actions. <%= @actions.count(:conditions => "NOT completed_at IS NULL") %> of these are completed. +

You have <%= @tags.count-%> tags placed on actions. Of those tags, -<%= @unique_tags.size -%> are unique. \ No newline at end of file +<%= @unique_tags.size -%> are unique. +<% end -%> + diff --git a/tracks/app/views/stats/index.rhtml b/tracks/app/views/stats/index.rhtml index 140b7882..e7168fa8 100755 --- a/tracks/app/views/stats/index.rhtml +++ b/tracks/app/views/stats/index.rhtml @@ -3,6 +3,8 @@ <%= render :partial => 'totals' -%> +<% unless @actions.count == 0 -%> +

Actions

<%= render :partial => 'actions' -%> @@ -18,4 +20,11 @@

Tags

<%= render :partial => 'tags' -%> + +<% else -%> + +

More statistics will appear here once you have added some actions.

+ +<% end -%> + \ No newline at end of file