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
1675501c
Commit
1675501c
authored
Sep 30, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add catalog_ids to Product
parent
98f4cee7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
product.rb
lib/shotengai/product.rb
+10
-1
snapshot.rb
lib/shotengai/snapshot.rb
+8
-0
No files found.
lib/shotengai/product.rb
View file @
1675501c
...
@@ -19,6 +19,7 @@ module Shotengai
...
@@ -19,6 +19,7 @@ module Shotengai
# manager_type :string(255)
# manager_type :string(255)
# created_at :datetime not null
# created_at :datetime not null
# updated_at :datetime not null
# updated_at :datetime not null
# remark :json
#
#
# Indexes
# Indexes
#
#
...
@@ -133,8 +134,16 @@ module Shotengai
...
@@ -133,8 +134,16 @@ module Shotengai
send
(
"
#{
list_name
}
="
,
catalog_class
.
ids_to_tags
(
ids
))
send
(
"
#{
list_name
}
="
,
catalog_class
.
ids_to_tags
(
ids
))
}
}
define_method
(
"
#{
tag_name
}
_ids"
)
{
send
(
list_name
).
map
(
&
:id
)
}
define_method
(
"
#{
tag_name
}
_names"
)
{
send
(
list_name
).
map
(
&
:name
)
}
define_method
(
list_name
)
{
define_method
(
list_name
)
{
catalog_class
.
where
(
id:
super
().
map
{
|
tag
|
Shotengai
::
Catalog
.
parse_tag
(
tag
)
})
.
select
(
:name
).
map
(
&
:name
)
catalog_class
.
where
(
id:
super
().
map
{
|
tag
|
Shotengai
::
Catalog
.
parse_tag
(
tag
)
})
}
}
end
end
...
...
lib/shotengai/snapshot.rb
View file @
1675501c
...
@@ -93,6 +93,14 @@ module Shotengai
...
@@ -93,6 +93,14 @@ module Shotengai
full_meta
[
'snapshot'
]
||
{}
full_meta
[
'snapshot'
]
||
{}
end
end
def
product_meta
full_meta
[
'product'
]
end
def
series_meta
full_meta
[
'series'
]
end
def
meta
=
val
def
meta
=
val
self
.
full_meta
=
full_meta
.
merge
(
'snapshot'
=>
val
)
self
.
full_meta
=
full_meta
.
merge
(
'snapshot'
=>
val
)
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