Skip to content
This repository has been archived by the owner on Jul 17, 2019. It is now read-only.

Commit

Permalink
Tell the user how to set up the goal.
Browse files Browse the repository at this point in the history
  • Loading branch information
dividedmind committed Dec 30, 2012
1 parent 74e1e5c commit 08728b9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/models/beeminder_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ def client
end

def goal
client.goal goal_name rescue nil
@goal ||= client.goal goal_name rescue nil
end

def create_goal
client.create_goal goal_options
end

def goal_ok?
return unless goal
goal.instance_variable_get(:@kyoom) && goal.instance_variable_get(:@aggday) == 'last'
end

private

Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ def total_days
def days_till_now
Date.today - hours.last['worked_on'] + 1
end

def ok_to_push
odesk && beeminder && beeminder.goal_ok?
end
end
8 changes: 7 additions & 1 deletion app/views/dashboard/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
%h1 Beemindesk
= button_to "Push data", push_data_beeminder_path
- if @user && @user.ok_to_push
= button_to "Push data", push_data_beeminder_path
%article
%section.odesk
%h2 ODesk
Expand Down Expand Up @@ -33,6 +34,11 @@
%p Goal doesn't exist.
= button_to "create it", create_goal_beeminder_path
- else
- unless @user.beeminder.goal_ok?
%p
Goal isn't set up right.
Please set kyoom = true and aggday = last.
You might also want to turn on steppy.
%table
- for d in @user.datapoints.sort {|b, a| a.timestamp <=> b.timestamp }
%tr
Expand Down

0 comments on commit 08728b9

Please sign in to comment.