mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 08:31:36 -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:
@@ -0,0 +1,8 @@
|
||||
class CreateCreditConversions < ActiveRecord::Migration
|
||||
def change
|
||||
create_table(:credit_conversions) do |t|
|
||||
t.integer :conversion, :default => 1
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
+10
-4
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130614003934) do
|
||||
ActiveRecord::Schema.define(:version => 20130629152047) do
|
||||
|
||||
create_table "bike_actions", :force => true do |t|
|
||||
t.string "action", :limit => 128, :null => false
|
||||
@@ -65,6 +65,12 @@ ActiveRecord::Schema.define(:version => 20130614003934) do
|
||||
|
||||
add_index "bikes", ["shop_id"], :name => "index_bikes_on_shop_id", :unique => true
|
||||
|
||||
create_table "credit_conversions", :force => true do |t|
|
||||
t.integer "conversion", :default => 1
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "customers", :force => true do |t|
|
||||
t.string "first_name", :null => false
|
||||
t.string "last_name", :null => false
|
||||
@@ -155,9 +161,9 @@ ActiveRecord::Schema.define(:version => 20130614003934) do
|
||||
end
|
||||
|
||||
create_table "user_role_joins", :force => true do |t|
|
||||
t.integer "role_id", :limit => 255
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "role_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "ends"
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
conversion:
|
||||
id: 1
|
||||
conversion: 10
|
||||
Reference in New Issue
Block a user