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
98f4cee7
Commit
98f4cee7
authored
Sep 29, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate the snapshot own meta from the meta come from its product and series
parent
2c35a499
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
order_spec.rb
...generators/templates/spec/requests/customer/order_spec.rb
+1
-1
json_column.rb
lib/shotengai/json_column.rb
+0
-2
snapshot.rb
lib/shotengai/snapshot.rb
+19
-8
No files found.
lib/generators/templates/spec/requests/customer/order_spec.rb
View file @
98f4cee7
...
@@ -211,13 +211,13 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
...
@@ -211,13 +211,13 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
meta:
{
type: :object
},
meta:
{
type: :object
},
incr_snapshot_ids:
{
type: :array
},
incr_snapshot_ids:
{
type: :array
},
},
},
}
snapshot:
{
snapshot:
{
type: :object
,
properties:
{
type: :object
,
properties:
{
shotengai_series_id:
{
type: :integer
},
shotengai_series_id:
{
type: :integer
},
count:
{
type: :integer
},
count:
{
type: :integer
},
}
}
}
}
}
}
}
}
}
...
...
lib/shotengai/json_column.rb
View file @
98f4cee7
...
@@ -16,8 +16,6 @@ module Shotengai
...
@@ -16,8 +16,6 @@ module Shotengai
define_method("
#{
column
}
_input=") do |val|
define_method("
#{
column
}
_input=") do |val|
parsed_val = val && val.map{ |h| { (h[:key] || h['key']) => (h[:val] || h['val']) } }.reduce(&:merge)
parsed_val = val && val.map{ |h| { (h[:key] || h['key']) => (h[:val] || h['val']) } }.reduce(&:merge)
self.
#{
column
}
= parsed_val
self.
#{
column
}
= parsed_val
# self.assign_attributes('
#{
column
}
' => parsed_val)
end
end
define_method("
#{
column
}
_output") do
define_method("
#{
column
}
_output") do
...
...
lib/shotengai/snapshot.rb
View file @
98f4cee7
...
@@ -80,8 +80,21 @@ module Shotengai
...
@@ -80,8 +80,21 @@ module Shotengai
define_method
(
column
)
{
read_attribute
(
column
)
||
self
.
series
.
send
(
column
)
}
define_method
(
column
)
{
read_attribute
(
column
)
||
self
.
series
.
send
(
column
)
}
end
end
def
full_meta
read_attribute
(
:meta
)
||
{}
end
def
full_meta
=
val
write_attribute
(
:meta
,
val
)
end
def
meta
def
meta
read_attribute
(
:meta
)
||
(
series
.
product
.
meta
||
{}
).
merge
(
series
.
meta
||
{})
full_meta
[
'snapshot'
]
||
{}
end
def
meta
=
val
self
.
full_meta
=
full_meta
.
merge
(
'snapshot'
=>
val
)
end
end
def
already_disable
def
already_disable
...
@@ -111,7 +124,11 @@ module Shotengai
...
@@ -111,7 +124,11 @@ module Shotengai
banners:
series
.
banners
,
banners:
series
.
banners
,
cover_image:
series
.
cover_image
,
cover_image:
series
.
cover_image
,
detail:
series
.
detail
,
detail:
series
.
detail
,
meta:
(
product
.
meta
||
{}
).
merge
(
series
.
meta
||
{})
full_meta:
{
product:
product
.
meta
,
series:
series
.
meta
,
snapshot:
meta
,
}
)
)
end
end
...
@@ -138,12 +155,6 @@ module Shotengai
...
@@ -138,12 +155,6 @@ module Shotengai
def
order_status
;
shotengai_order
&
.
status
end
def
order_status
;
shotengai_order
&
.
status
end
def
order_status_zh
;
shotengai_order
&
.
status_zh
end
def
order_status_zh
;
shotengai_order
&
.
status_zh
end
######
def
meta
super
||
{}
end
private
private
# spec 字段
# spec 字段
def
check_spec
def
check_spec
...
...
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