1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

Fix a bug: edge case of birthday in the future in seeds.rb, we should use Date.current instead of DateTime.current since birthday is a date (see https://github.com/sleede/fab-manager/issues/344)

This commit is contained in:
Nicolas Florentin 2022-05-04 08:50:10 +02:00
parent 5cffdff65a
commit 5e5822c89f
3 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@
## next deploy
- when generating an avoir, the option "by_wallet" is not present anymore if wallet module is off
- Fix a bug: edge case of birthday in the future in seeds.rb, we should use Date.current instead of DateTime.current since birthday is a date (see https://github.com/sleede/fab-manager/issues/344)
## v5.3.13 2022 May 02

View File

@ -46,6 +46,6 @@ class StatisticProfile < ApplicationRecord
private
def check_birthday_in_past
errors.add(:birthday, I18n.t('statistic_profile.birthday_in_past')) if birthday.present? && birthday > DateTime.current
errors.add(:birthday, I18n.t('statistic_profile.birthday_in_past')) if birthday.present? && birthday > Date.current
end
end

View File

@ -89,7 +89,7 @@ if Role.where(name: 'admin').joins(:users).count.zero?
admin = User.new(username: 'admin', email: ENV['ADMIN_EMAIL'], password: ENV['ADMIN_PASSWORD'],
password_confirmation: Rails.application.secrets.admin_password, group_id: Group.find_by(slug: 'admins').id,
profile_attributes: { first_name: 'admin', last_name: 'admin', phone: '0123456789' },
statistic_profile_attributes: { gender: true, birthday: DateTime.current })
statistic_profile_attributes: { gender: true, birthday: Date.current })
admin.add_role 'admin'
admin.save!
end