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
3735d662
Commit
3735d662
authored
Sep 11, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec validation in series & Add code about stock in series
parent
2a046bc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
series.rb
lib/shotengai/series.rb
+6
-1
No files found.
lib/shotengai/series.rb
View file @
3735d662
...
@@ -55,6 +55,11 @@ module Shotengai
...
@@ -55,6 +55,11 @@ module Shotengai
end
end
end
end
def
cut_stock
count
self
.
stock
-=
count
self
.
save!
end
private
private
# spec 字段
# spec 字段
def
check_spec_value
def
check_spec_value
...
@@ -66,7 +71,7 @@ module Shotengai
...
@@ -66,7 +71,7 @@ module Shotengai
end
end
def
uniq_spec
def
uniq_spec
errors
.
add
(
:spec
,
'Non uniq spec for the product.'
)
if
self
.
class
.
where
(
self
.
spec
,
self
.
product
).
any?
errors
.
add
(
:spec
,
'Non uniq spec for the product.'
)
if
self
.
class
.
query_spec_with_product
(
self
.
spec
,
self
.
product
).
any?
end
end
def
validate_stock
def
validate_stock
...
...
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