Author: assaf
Date: Sat Jun 7 00:08:27 2008
New Revision: 664293
URL: http://svn.apache.org/viewvc?rev=664293&view=rev
Log:
Necessary fixes to db:populate tasks, and checking out sparklines for activity
page.
Added:
ode/sandbox/singleshot/.gitignore
Modified:
ode/sandbox/singleshot/app/views/activity/index.html.erb
ode/sandbox/singleshot/db/schema.rb
ode/sandbox/singleshot/lib/tasks/populate.rake
Added: ode/sandbox/singleshot/.gitignore
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/.gitignore?rev=664293&view=auto
==============================================================================
--- ode/sandbox/singleshot/.gitignore (added)
+++ ode/sandbox/singleshot/.gitignore Sat Jun 7 00:08:27 2008
@@ -0,0 +1,3 @@
+tmp
+log
+db/*.sqlite3
Modified: ode/sandbox/singleshot/app/views/activity/index.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/activity/index.html.erb?rev=664293&r1=664292&r2=664293&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/activity/index.html.erb (original)
+++ ode/sandbox/singleshot/app/views/activity/index.html.erb Sat Jun 7
00:08:27 2008
@@ -1,4 +1,6 @@
<% by_date = group_by_dates(@activities, :created_at) %>
+<div class='right'><%= sparkline_tag @activities.group_by { |activity|
activity.created_at.to_date }.map { |time, list| list.size },
+ :title=>'Level of activity for each day'
unless @activities.empty? %></div>
<ol class='dates hfeed'>
<% for date, activities in by_date %>
<li class='date'>
Modified: ode/sandbox/singleshot/db/schema.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/db/schema.rb?rev=664293&r1=664292&r2=664293&view=diff
==============================================================================
--- ode/sandbox/singleshot/db/schema.rb (original)
+++ ode/sandbox/singleshot/db/schema.rb Sat Jun 7 00:08:27 2008
@@ -30,10 +30,10 @@
t.datetime "updated_at"
end
- add_index "people", ["access_key"], :name => "index_people_on_access_key",
:unique => true
- add_index "people", ["email"], :name => "index_people_on_email", :unique =>
true
- add_index "people", ["fullname"], :name => "index_people_on_fullname"
add_index "people", ["identity"], :name => "index_people_on_identity",
:unique => true
+ add_index "people", ["fullname"], :name => "index_people_on_fullname"
+ add_index "people", ["email"], :name => "index_people_on_email", :unique =>
true
+ add_index "people", ["access_key"], :name => "index_people_on_access_key",
:unique => true
create_table "stakeholders", :force => true do |t|
t.integer "task_id", :null => false
Modified: ode/sandbox/singleshot/lib/tasks/populate.rake
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/populate.rake?rev=664293&r1=664292&r2=664293&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/populate.rake (original)
+++ ode/sandbox/singleshot/lib/tasks/populate.rake Sat Jun 7 00:08:27 2008
@@ -2,12 +2,11 @@
desc 'Populate the database with mock values'
task 'populate'=>['environment', 'create', 'migrate'] do
- you = Person.find_by_identity(ENV['USER'])
- unless you
- you = Person.create(:email=>"#{ENV['USER'[EMAIL PROTECTED]",
:password=>'secret')
- puts 'Created an account for you:'
+ you = Person.identify(ENV['USER']) rescue begin
+ puts 'Creating an account for you:'
puts " Username: #{ENV['USER']}"
puts ' Password: secret'
+ Person.create!(:email=>"#{ENV['USER'[EMAIL PROTECTED]",
:password=>'secret')
end
puts "Populating database for #{you.identity}"
@@ -16,7 +15,7 @@
Task.delete_all
def other
- Person.identify('anon') || Person.create(:email=>'[EMAIL PROTECTED]')
+ Person.identify('anon') rescue Person.create(:email=>'[EMAIL PROTECTED]')
end
def Task.delay(duration = 2.hours)
for model in [Task, Stakeholder, Activity]
@@ -33,7 +32,7 @@
def create(attributes)
Task.delay
- you = Person.find_by_identity(ENV['USER'])
+ you = Person.identify(ENV['USER'])
defaults = { :title=>Faker::Lorem.sentence,
:description=>Faker::Lorem.paragraphs(3).join("\n\n"),
:rendering=>{
:perform_url=>'http://localhost:3001/sandwich', :integrated_ui=>true },
:potential_owners=>[you, other] }
returning Task.new(defaults.merge(attributes || {})) do |task|