Recalculate stats after changing distance units

This commit is contained in:
Eugene Burmakin
2025-07-20 19:14:20 +02:00
parent f969d5d3e6
commit 8b03b0c7f5
4 changed files with 28 additions and 2 deletions

View File

@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [0.29.2] - 2025-07-12
⚠️ If you were using RC, please run the following commands in the console, otherwise read on. ⚠️
```ruby
# This will delete all tracks 👇
Track.delete_all
# This will remove all tracks relations from points 👇
Point.update_all(track_id: nil)
# This will create tracks for all users 👇
User.find_each do |user|
Tracks::CreateJob.perform_later(user.id, start_at: nil, end_at: nil, mode: :bulk)
end
```
## Added
- In the User Settings -> Background Jobs, you can now disable visits suggestions, which is enabled by default. It's a background task that runs every day around midnight. Disabling it might be useful if you don't want to receive visits suggestions or if you're using the Dawarich iOS app, which has its own visits suggestions.

View File

@@ -4,7 +4,7 @@ class BulkStatsCalculatingJob < ApplicationJob
queue_as :stats
def perform
user_ids = User.pluck(:id)
user_ids = User.active.pluck(:id)
user_ids.each do |user_id|
Stats::BulkCalculator.new(user_id).call

View File

@@ -0,0 +1,11 @@
# frozen_string_literal: true
class RecalculateStatsAfterChangingDistanceUnits < ActiveRecord::Migration[8.0]
def up
BulkStatsCalculatingJob.perform_later
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@@ -1 +1 @@
DataMigrate::Data.define(version: 20250709195003)
DataMigrate::Data.define(version: 20250720171241)