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
17f8ea6e
Commit
17f8ea6e
authored
Sep 20, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve sql in snapshot
parent
cd3c849a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
15 deletions
+3
-15
snapshot.rb
lib/shotengai/snapshot.rb
+3
-15
No files found.
lib/shotengai/snapshot.rb
View file @
17f8ea6e
...
@@ -39,21 +39,9 @@ module Shotengai
...
@@ -39,21 +39,9 @@ module Shotengai
belongs_to
:shotengai_cart
,
foreign_key: :shotengai_order_id
,
belongs_to
:shotengai_cart
,
foreign_key: :shotengai_order_id
,
class_name:
'Shotengai::Cart'
,
optional:
true
,
touch:
true
class_name:
'Shotengai::Cart'
,
optional:
true
,
touch:
true
scope
:in_order
,
->
{
scope
:in_order
,
->
{
joins
(
:shotengai_order
).
where
.
not
(
shotengai_orders:
{
status:
'cart'
})
}
joins
(
"
scope
:in_cart
,
->
{
joins
(
:shotengai_order
).
where
(
shotengai_orders:
{
status:
'cart'
})
}
INNER JOIN shotengai_orders ON
shotengai_snapshots.shotengai_order_id = shotengai_orders.id AND
shotengai_orders.status <> 'cart'
"
)
}
scope
:in_cart
,
->
{
joins
(
"
INNER JOIN shotengai_orders ON
shotengai_snapshots.shotengai_order_id = shotengai_orders.id AND
shotengai_orders.status = 'cart'
"
)
}
class
<<
self
class
<<
self
def
inherited
subclass
def
inherited
subclass
product_name
=
/^(.+)Snapshot/
.
match
(
subclass
.
name
)[
1
]
product_name
=
/^(.+)Snapshot/
.
match
(
subclass
.
name
)[
1
]
...
...
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