Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Commit

Permalink
Support more than 10 changes a day (LH#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Feb 11, 2009
1 parent 22a274f commit a512f10
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/models/soa.rb
Expand Up @@ -62,16 +62,14 @@ def update_serial

@serial_updated = true

date_segment = Time.now.strftime( "%Y%m%d" )
date_serial = Time.now.strftime( "%Y%m%d00" ).to_i

# Same day change?
increment = if date_segment == self.serial.to_s[0,8]
increment = self.serial.to_s[9,2].succ
self.serial = if date_serial > self.serial
date_serial
else
"01"
self.serial + 1
end

self.serial = ( date_segment + increment.rjust(2, "0") ).to_i
end

# Same as #update_serial and saves the record
Expand Down

0 comments on commit a512f10

Please sign in to comment.