Fix bug. #5

Merged
chiu merged 1 commits from 123/seminar:master into master 2023-01-16 09:58:10 +00:00
1 changed files with 3 additions and 4 deletions
Showing only changes of commit a45db2488e - Show all commits

View File

@ -51,10 +51,9 @@ class SeminarSignup
[l, (tmp ? tmp : unit)]
end.to_h
if self.serial_number.nil?
s = SeminarMain.find(self.seminar_main)
s.last_serial_number += 1
self.serial_number = s.last_serial_number
s.save(:validate=>false)
last_serial_number = SeminarMain.where(:id=>self.seminar_main_id).max(:last_serial_number).to_i
self.serial_number = last_serial_number + 1
SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}})
end
end
after_destroy do