app/models/pilot.rb
# Assign the next available PilotID based on the last pilot and
# the starting value
#
Assign the next available PilotID based on the last pilot and
the starting value
Assign the next available PilotID based on the last pilot and the starting value
def assign_pid
    start = Setting.starting_pid
    self.pid = if Pilot.exists?
                 last = Pilot.order(pid: :asc).last
                 (last.pid >= start ? last.pid + 1 : start)
               else
                 start
               end
  end
def assign_pid start = Setting . starting_pid self . pid = if Pilot . exists? last = Pilot . order ( pid : :asc ) . last ( last . pid >= start ? last . pid + 1 : start ) else start end end
Assign the next available PilotID based on the last pilot and
the starting value
Assign the next available PilotID based on the last pilot and the starting value