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
60799c69
Commit
60799c69
authored
Sep 16, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add round 2 to order amount
parent
eb799753
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
order.rb
lib/shotengai/order.rb
+4
-6
No files found.
lib/shotengai/order.rb
View file @
60799c69
...
...
@@ -106,23 +106,21 @@ module Shotengai
end
def
set_amount
self
.
update!
(
amount:
product_amount
+
delivery_cost
)
self
.
update!
(
amount:
(
product_amount
+
delivery_cost
).
round
(
2
)
)
end
def
amount
read_attribute
(
:amount
)
||
product_amount
+
delivery_cost
read_attribute
(
:amount
)
||
(
product_amount
+
delivery_cost
).
round
(
2
)
end
def
product_amount
snapshots
.
sum
(
&
:total_price
)
snapshots
.
sum
(
&
:total_price
)
.
round
(
2
)
end
def
product_original_amount
snapshots
.
sum
(
&
:total_original_price
)
snapshots
.
sum
(
&
:total_original_price
)
.
round
(
2
)
end
# into order
def
incr_snapshot_ids
=
ids
ActiveRecord
::
Base
.
transaction
do
...
...
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