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
f35451b2
Commit
f35451b2
authored
Nov 16, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A
parent
1bf6c345
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
product.rb
lib/shotengai/product.rb
+4
-4
series.rb
lib/shotengai/series.rb
+1
-1
No files found.
lib/shotengai/product.rb
View file @
f35451b2
...
...
@@ -74,10 +74,6 @@ module Shotengai
Shotengai
::
Series
.
alive
.
find_by_id
(
default_series_id
)
||
series
.
alive
.
first
end
def
series_with_spec_value
val
,
eql
=
true
series_class
.
query_spec_value_with_product
(
val
,
self
,
eql
)
end
def
meta
super
||
{}
end
...
...
@@ -150,6 +146,10 @@ module Shotengai
}
end
end
def
series_with_spec_value
val
,
eql:
true
series_class
.
query_spec_value_with_product
(
val
,
self
,
eql:
eql
)
end
end
end
end
lib/shotengai/series.rb
View file @
f35451b2
...
...
@@ -54,7 +54,7 @@ module Shotengai
scope
:recycle_bin
,
->
{
unscope
(
where: :aasm_state
).
deleted
.
where
(
'updated_at < ?'
,
Time
.
now
-
10
.
day
)}
# where("spec->'$.\"颜色\"' = ? and spec->'$.\"大小\"' = ?" ,红色,S)
scope
:query_spec_value_with_product
,
->
(
val
,
product
,
eql
=
true
)
{
scope
:query_spec_value_with_product
,
->
(
val
,
product
,
eql
:
true
)
{
if
val
.
keys
.
sort
==
product
.
spec_template
.
keys
.
sort
||
(
eql
.!
&&
(
val
.
keys
-
product
.
spec_template
.
keys
).
empty?
)
keys
=
[];
values
=
[];
proc
=
Proc
.
new
{
|
k
,
v
|
keys
<<
"spec_value->'$.
\"
#{
k
}
\"
' = ? "
;
values
<<
v
}
...
...
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