update member discount and seed for detail

This commit is contained in:
Aung Myo
2017-07-12 17:05:10 +06:30
parent ac7b4dc56d
commit 1d873ddb68
16 changed files with 94 additions and 63 deletions

View File

@@ -60,8 +60,15 @@ class SeedGenerator < ApplicationRecord
seed.save
end
padding_len = 5 - prefix.length
next_code = prefix + seed.current.to_s.to_s.rjust((4-prefix.length)+1,'0')
if prefix.length == 1
padding_len = 5 - prefix.length
count = 4-prefix.length
else prefix.length == 2
padding_len = 6 - prefix.length
count = 5-prefix.length
end
next_code = prefix + seed.current.to_s.to_s.rjust((count)+1,'0')
return next_code
end
end