Simplify set_week callbacks

Changes to :week are already ignored py paper_trail. No need to wrap this in a
`without_versioning`. Also drop the reader in `Registration` and the tests. Why
write this into the DB but never read it again? Why test standard
ruby/activerecord stuff.
This commit is contained in:
Henne Vogelsang 2018-09-03 21:28:14 +02:00
parent f458736a39
commit fb2612ecaf
3 changed files with 2 additions and 30 deletions

View file

@ -317,10 +317,7 @@ class Event < ApplicationRecord
end
def set_week
self.week = created_at.strftime('%W')
paper_trail.without_versioning do
save!
end
update!(week: created_at.strftime('%W'))
end
def before_end_of_conference

View file

@ -46,10 +46,6 @@ class Registration < ApplicationRecord
(conference.program.events.with_registration_open - events) + events
end
def week
created_at.strftime('%W').to_i
end
private
##
@ -76,10 +72,7 @@ class Registration < ApplicationRecord
end
def set_week
self.week = created_at.strftime('%W')
paper_trail.without_versioning do
save!
end
update!(week: created_at.strftime('%W'))
end
def registration_limit_not_exceed