fix seed generator length

This commit is contained in:
Thein Lin Kyaw
2020-01-07 13:06:29 +06:30
parent eb65271d35
commit cf7d8c85d6

View File

@@ -17,7 +17,7 @@ class SeedGenerator < ApplicationRecord
end
seed = self.update_seed(model_name)
length = 15 - prefix.length
length = 16 - prefix.length
prefix + seed.to_s.rjust(length, '0')
end
@@ -39,7 +39,7 @@ class SeedGenerator < ApplicationRecord
start = self.update_seed(model_name, count)
stop = start + count - 1
length = 15 - prefix.length
length = 16 - prefix.length
(start..stop).map { |c| prefix + c.to_s.rjust(length, '0') }
end