Fix a few bugs

This commit is contained in:
Eugene Burmakin 2025-05-18 19:48:52 +02:00
parent 38a32f245f
commit cf3b7a116d
6 changed files with 52 additions and 6 deletions

View file

@ -1 +1 @@
0.26.1
0.26.2

View file

@ -5,7 +5,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
# 0.26.1 - 2025-05-15
# 0.26.2 - 2025-05-18
## Fixed
- Seeds are now working properly. #1207
- Fixed a bug where France flag was not being displayed correctly. #1204
- Fix blank map page caused by empty default distance unit. Default distance unit is now kilometers and can be changed in Settings -> Maps. #1206
# 0.26.1 - 2025-05-18
## Geodata on demand

View file

@ -0,0 +1,11 @@
# frozen_string_literal: true
class FixFranceCodes < ActiveRecord::Migration[8.0]
def up
Country.find_by(name: 'France')&.update(iso_a2: 'FR', iso_a3: 'FRA')
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -0,0 +1,24 @@
# frozen_string_literal: true
class SetDefaultDistanceUnitForUser < ActiveRecord::Migration[8.0]
def up
User.find_each do |user|
map_settings = user.settings['maps']
next if map_settings['distance_unit'].in?(%w[km mi])
if map_settings.blank?
map_settings = { distance_unit: 'km' }
else
map_settings['distance_unit'] = 'km'
end
user.settings['maps'] = map_settings
user.save!
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View file

@ -1 +1 @@
DataMigrate::Data.define(version: 20250516181033)
DataMigrate::Data.define(version: 20250518174305)

View file

@ -3,16 +3,18 @@
if User.none?
puts 'Creating user...'
email = 'demo@dawarich.app'
User.create!(
email: 'demo@dawarich.app',
email:,
password: 'password',
password_confirmation: 'password',
admin: true,
active: true,
status: :active,
active_until: 100.years.from_now
)
puts "User created: #{User.first.email} / password: 'password'"
puts "User created: '#{email}' / password: 'password'"
end
if Country.none?