Merge branch '997-stats' into vacation-work

This commit is contained in:
Reinier Balt 2010-05-02 18:34:10 +02:00
commit dc0dab9863
3 changed files with 17 additions and 11 deletions

View file

@ -319,6 +319,7 @@ class StatsController < ApplicationController
# - actions not part of a hidden project
# - actions not part of a hidden context
# - actions not deferred (show_from must be null)
# - actions not pending/blocked
@actions_running_time = @actions.find_by_sql([
"SELECT t.created_at "+
@ -326,7 +327,7 @@ class StatsController < ApplicationController
"WHERE t.user_id=? "+
"AND t.completed_at IS NULL " +
"AND t.show_from IS NULL " +
"AND NOT (p.state='hidden' OR c.hide=?) " +
"AND NOT (p.state='hidden' OR p.state='pending' OR c.hide=?) " +
"ORDER BY t.created_at ASC", @user.id, true]
)

View file

@ -18,7 +18,10 @@ class Todo < ActiveRecord::Base
named_scope :active, :conditions => { :state => 'active' }
named_scope :not_completed, :conditions => ['NOT (todos.state = ? )', 'completed']
named_scope :completed, :conditions => ["NOT completed_at IS NULL"]
named_scope :are_due, :conditions => ['NOT (todos.due IS NULL)']
named_scope :deferred, :conditions => ["completed_at IS NULL AND NOT show_from IS NULL"]
named_scope :blocked, :conditions => ['todos.state = ?', 'pending']
STARRED_TAG_NAME = "starred"
RE_TODO = /[^"]+/

View file

@ -1,19 +1,21 @@
<p>You have <%= @projects.count%> projects.
Of those <%= @projects.count(:conditions => "state = 'active'")%> are active projects,
<%= @projects.count(:conditions => "state = 'hidden'")%> hidden projects and
<%= @projects.count(:conditions => "state = 'completed'")%> completed projects</p>
Of those <%= @projects.active.count%> are active projects,
<%= @projects.hidden.count%> hidden projects and
<%= @projects.completed.count%> completed projects</p>
<p>You have <%= @contexts.count%> contexts.
Of those <%= @contexts.count(:conditions => ["hide = ?", false])%> are visible contexts and
<%= @contexts.count(:conditions => ["hide = ?", true]) %> are hidden contexts
Of those <%= @contexts.active.count%> are visible contexts and
<%= @contexts.hidden.count%> are hidden contexts
<% unless @actions.empty? -%>
<p>You have <%= @actions.count(:conditions => "completed_at IS NULL") %> incomplete actions
of which <%= @actions.count(:conditions => "completed_at IS NULL AND NOT show_from IS NULL") %> are deferred actions. </p>
<p>Since your first action on <%= format_date(@first_action.created_at) %>
you have a total of <%= @actions.count %> actions.
<%= @actions.completed.count %> of these are completed.
<p>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.
<p>You have <%= @actions.not_completed.count %> incomplete actions
of which <%= @actions.deferred.count %> are deferred actions
in the tickler and <%= @actions.blocked.count %> are dependent on the completion of other actions.
. </p>
<p>You have <%= @tags_count-%> tags placed on actions. Of those tags,
<%= @unique_tags_count -%> are unique.