Author: assaf
Date: Fri Jun  6 20:27:01 2008
New Revision: 664264

URL: http://svn.apache.org/viewvc?rev=664264&view=rev
Log:
Now showing sparkline of task completed each day for the past month.

Modified:
    ode/sandbox/singleshot/app/controllers/tasks_controller.rb
    ode/sandbox/singleshot/app/views/tasks/completed.html.erb

Modified: ode/sandbox/singleshot/app/controllers/tasks_controller.rb
URL: 
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/controllers/tasks_controller.rb?rev=664264&r1=664263&r2=664264&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/controllers/tasks_controller.rb (original)
+++ ode/sandbox/singleshot/app/controllers/tasks_controller.rb Fri Jun  6 
20:27:01 2008
@@ -26,7 +26,9 @@
                    Mime::ICS=>formatted_completed_tasks_url(:format=>:ics, 
:access_key=>authenticated.access_key) }
     @tasks = Task.completed.for_stakeholder(authenticated).with_stakeholders
     respond_to do |wants|
-      wants.html
+      wants.html do
+        @graph = Task.connection.select_values("SELECT tasks.updated_at FROM 
tasks JOIN stakeholders ON stakeholders.task_id = tasks.id WHERE 
person_id=#{authenticated.id} AND role='owner' AND status='completed' AND 
tasks.updated_at >= '#{Date.today - 1.month}'").group_by { |date| date.to_date 
}.map { |date, entries| entries.size }
+      end
       # TODO: wants.xml
       # TODO: wants.json
       wants.atom { render :action=>'index' }

Modified: ode/sandbox/singleshot/app/views/tasks/completed.html.erb
URL: 
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/completed.html.erb?rev=664264&r1=664263&r2=664264&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/completed.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/completed.html.erb Fri Jun  6 
20:27:01 2008
@@ -1,5 +1,5 @@
 <% by_date = group_by_dates(@tasks, :updated_at) %>
-<div class='right'><%= sparkline_tag @tasks.group_by { |task| 
task.updated_at.to_date }.map { |date, tasks| tasks.size } %></div>
+<div class='right'><%= sparkline_tag @graph, :title=>'Tasks completed each day 
in the last month' unless @graph.empty? %></div>
 <ol class='dates hfeed'>
   <% for date, tasks in by_date %>
     <li class='date'>


Reply via email to