Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
shotengai
Commits
9ec8f4c7
Commit
9ec8f4c7
authored
Sep 15, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add column title to snapshot
parent
4e007d9e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
25 deletions
+22
-25
.rspec_status
.rspec_status
+0
-20
1_create_shotengai_products_and_orders.rb
db/migrate/1_create_shotengai_products_and_orders.rb
+1
-0
_snapshot.json.jbuilder
lib/generators/templates/views/share/_snapshot.json.jbuilder
+3
-1
_snapshot_simple.json.jbuilder
...tors/templates/views/share/_snapshot_simple.json.jbuilder
+3
-1
series.rb
lib/shotengai/series.rb
+1
-1
snapshot.rb
lib/shotengai/snapshot.rb
+6
-2
shotengai_snapshots.rb
spec/factories/shotengai_snapshots.rb
+8
-0
No files found.
.rspec_status
deleted
100644 → 0
View file @
4e007d9e
example_id | status | run_time |
------------------------------------------ | ------ | --------------- |
./spec/shotengai/models_spec.rb[1:1:1:1] | passed | 0.76841 seconds |
./spec/shotengai/models_spec.rb[1:1:1:2] | passed | 0.39895 seconds |
./spec/shotengai/models_spec.rb[1:1:2:1] | passed | 0.40877 seconds |
./spec/shotengai/models_spec.rb[1:1:2:2] | passed | 0.40292 seconds |
./spec/shotengai/models_spec.rb[1:1:2:3] | passed | 0.40936 seconds |
./spec/shotengai/models_spec.rb[1:1:2:4] | passed | 0.39549 seconds |
./spec/shotengai/models_spec.rb[1:1:3:1] | passed | 0.36859 seconds |
./spec/shotengai/models_spec.rb[1:1:3:2] | passed | 0.3979 seconds |
./spec/shotengai/models_spec.rb[1:1:3:3] | passed | 0.40805 seconds |
./spec/shotengai/models_spec.rb[1:1:4:1] | failed | 0.66932 seconds |
./spec/shotengai/models_spec.rb[1:1:5:1] | passed | 0.38994 seconds |
./spec/shotengai/models_spec.rb[1:1:5:2:1] | passed | 0.48448 seconds |
./spec/shotengai/models_spec.rb[1:1:5:2:2] | failed | 0.56715 seconds |
./spec/shotengai/models_spec.rb[1:2:1:1] | passed | 0.40297 seconds |
./spec/shotengai/models_spec.rb[1:2:1:2] | passed | 0.3698 seconds |
./spec/shotengai/models_spec.rb[1:2:2:1] | passed | 0.66138 seconds |
./spec/shotengai/models_spec.rb[1:2:2:2] | passed | 0.48194 seconds |
./spec/shotengai/models_spec.rb[1:3:1] | passed | 0.37498 seconds |
db/migrate/1_create_shotengai_products_and_orders.rb
View file @
9ec8f4c7
...
...
@@ -77,6 +77,7 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1]
def
create_snapshot
create_table
:shotengai_snapshots
do
|
t
|
t
.
string
:title
t
.
decimal
:original_price
,
precision:
9
,
scale:
2
t
.
decimal
:price
,
precision:
9
,
scale:
2
# Merchant can change the amount of snapshot
...
...
lib/generators/templates/views/share/_snapshot.json.jbuilder
View file @
9ec8f4c7
json.extract! snapshot, :id, :shotengai_series_id, :original_price, :price, :count,
json.extract! snapshot, :id, :title, :shotengai_series_id,
:original_price, :price, :count,
:product_status_zh, :order_status_zh, :product_status, :order_status,
:total_price, :total_original_price, :revised_amount,
:spec, :cover_image, :banners, :detail, :meta, :is_in_cart
\ No newline at end of file
lib/generators/templates/views/share/_snapshot_simple.json.jbuilder
View file @
9ec8f4c7
json.extract! snapshot, :id, :shotengai_series_id, :original_price, :price, :count,
json.extract! snapshot, :id, :title, :shotengai_series_id,
:original_price, :price, :count, :title,
:product_status_zh, :order_status_zh, :product_status, :order_status,
:total_price, :total_original_price, :revised_amount,
:spec, :cover_image, :meta, :is_in_cart
\ No newline at end of file
lib/shotengai/series.rb
View file @
9ec8f4c7
...
...
@@ -75,7 +75,7 @@ module Shotengai
def
meta
super
||
{}
end
private
# spec 字段
def
check_spec_value
...
...
lib/shotengai/snapshot.rb
View file @
9ec8f4c7
...
...
@@ -4,6 +4,7 @@ module Shotengai
# Table name: shotengai_snapshots
#
# id :integer not null, primary key
# title :string(255)
# original_price :decimal(9, 2)
# price :decimal(9, 2)
# revised_amount :decimal(9, 2)
...
...
@@ -71,9 +72,11 @@ module Shotengai
end
end
# QUESTION: spec 赋值是在 after pay 合理?
# 支付前 信息 delegate to series
[
:original_price
,
:price
,
:spec
,
:banners
,
:cover_image
,
:detail
].
each
do
|
column
|
%i{
original_price price spec banners
cover_image detail title
}
.
each
do
|
column
|
define_method
(
column
)
{
read_attribute
(
column
)
||
self
.
series
.
send
(
column
)
}
end
...
...
@@ -85,6 +88,7 @@ module Shotengai
def
copy_info
# cut_stock
self
.
update!
(
title:
series
.
title
,
original_price:
series
.
original_price
,
price:
series
.
price
,
spec:
series
.
spec
,
...
...
spec/factories/shotengai_snapshots.rb
View file @
9ec8f4c7
...
...
@@ -3,6 +3,7 @@
# Table name: shotengai_snapshots
#
# id :integer not null, primary key
# title :string(255)
# original_price :decimal(9, 2)
# price :decimal(9, 2)
# revised_amount :decimal(9, 2)
...
...
@@ -17,7 +18,14 @@
# shotengai_order_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_shotengai_snapshots_on_shotengai_order_id (shotengai_order_id)
# index_shotengai_snapshots_on_shotengai_series_id (shotengai_series_id)
# index_shotengai_snapshots_on_type (type)
#
FactoryGirl
.
define
do
factory
:test_snapshot
,
class:
'TestGoodSnapshot'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment