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
935fe548
Commit
935fe548
authored
Jul 06, 2018
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use :shotengai_product instead of :product in series.rb
parent
bb12b081
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
series.rb
lib/shotengai/series.rb
+4
-4
No files found.
lib/shotengai/series.rb
View file @
935fe548
...
@@ -58,11 +58,11 @@ module Shotengai
...
@@ -58,11 +58,11 @@ module Shotengai
# where("spec->'$.\"颜色\"' = ? and spec->'$.\"大小\"' = ?" ,红色,S)
# 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?
)
if
val
.
keys
.
sort
==
shotengai_product
.
spec_template
.
keys
.
sort
||
(
eql
.!
&&
(
val
.
keys
-
shotengai_
product
.
spec_template
.
keys
).
empty?
)
keys
=
[];
values
=
[];
keys
=
[];
values
=
[];
proc
=
Proc
.
new
{
|
k
,
v
|
keys
<<
"spec_value->'$.
\"
#{
k
}
\"
' = ? "
;
values
<<
v
}
proc
=
Proc
.
new
{
|
k
,
v
|
keys
<<
"spec_value->'$.
\"
#{
k
}
\"
' = ? "
;
values
<<
v
}
Shotengai
::
Harray
===
val
?
val
.
hash_map
(
&
proc
)
:
val
.
map
(
&
proc
)
Shotengai
::
Harray
===
val
?
val
.
hash_map
(
&
proc
)
:
val
.
map
(
&
proc
)
where
(
product:
product
).
where
(
keys
.
join
(
' and '
),
*
values
)
where
(
product:
shotengai_
product
).
where
(
keys
.
join
(
' and '
),
*
values
)
else
else
self
.
none
self
.
none
end
end
...
@@ -137,7 +137,7 @@ module Shotengai
...
@@ -137,7 +137,7 @@ module Shotengai
end
end
def
uniq_spec_value
def
uniq_spec_value
if
self
.
class
.
query_spec_value_with_product
(
self
.
spec_value
,
self
.
product
).
alive
.
where
.
not
(
id:
self
.
id
).
any?
if
self
.
class
.
query_spec_value_with_product
(
self
.
spec_value
,
self
.
shotengai_
product
).
alive
.
where
.
not
(
id:
self
.
id
).
any?
errors
.
add
(
:spec_value
,
'Non uniq spec_value for the product.'
)
errors
.
add
(
:spec_value
,
'Non uniq spec_value for the product.'
)
end
end
end
end
...
@@ -148,7 +148,7 @@ module Shotengai
...
@@ -148,7 +148,7 @@ module Shotengai
def
check_remark_value
def
check_remark_value
# product.remark_value.keys 包含 remark_value.keys
# product.remark_value.keys 包含 remark_value.keys
illegal_key
=
(
remark_value
.
keys
-
product
.
remark_template
&
.
keys
)
illegal_key
=
(
remark_value
.
keys
-
shotengai_
product
.
remark_template
&
.
keys
)
errors
.
add
(
:remark_value
,
"非法的关键字,
#{
illegal_key
}
"
)
unless
illegal_key
.
empty?
errors
.
add
(
:remark_value
,
"非法的关键字,
#{
illegal_key
}
"
)
unless
illegal_key
.
empty?
end
end
end
end
...
...
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