mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-15 16:11:37 -04:00
Added credit tracking and stats
Added credit_conversions table so conversions can change over time Added default credit conversion fixture Added User#transaction_logs Added User#total_credits (earned minus spent) Added User#total_credits_spent (through transaction_logs) Added User#total_earned_credits (complicated query which finds the conversion rate for a log depending on its created_at date)
This commit is contained in:
@@ -3,11 +3,14 @@ class UserStats < Netzke::Base
|
||||
def body_content(user)
|
||||
bike = user.bike
|
||||
completed = user.completed_build_bikes
|
||||
#I think it's time to switch to a template
|
||||
#TODO I think it's time to switch to a template
|
||||
body = ""
|
||||
body += %Q(<div id="user_stats_page">)
|
||||
body += %Q(
|
||||
<p>Username: #{user.username}</p>
|
||||
<p>Total Credits Earned: #{user.total_earned_credits}</p>
|
||||
<p>Credits Available: #{user.total_credits}</p>
|
||||
<p>Credits Spent: #{user.total_credits_spent}</p>
|
||||
<p>Total Hours Worked: #{user.total_hours}</p>
|
||||
<p>Hours worked in #{Time.now.strftime('%B')}: #{user.current_month_hours}</p>
|
||||
<p>Current bike Shop ID: #{bike.shop_id if bike}</p>
|
||||
|
||||
Reference in New Issue
Block a user