Skip to content

Commit 7a4b071

Browse files
committed
Fix rubocop issues, update app version and changelog for v1.2.0 release
1 parent 29fb417 commit 7a4b071

File tree

11 files changed

+83
-95
lines changed

11 files changed

+83
-95
lines changed

.app_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0
1+
1.2.0

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7-
## [1.1.1] - Unreleased
7+
## [1.2.0] - 2026-02-15
88

99
### Changed
1010

@@ -22,7 +22,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2222

2323
- Scratch map layer is now working again on Map v2.
2424
- Colored routes on Map v2 are now working correctly. Zoom in closer to see colored segments. #2254
25-
- Frontend was sped by optimizing loaded assets and lazy-loading parts of the UI.
2625
- Live mode on Map v2 is now working again.
2726

2827
## [1.1.0] - 2026-02-08

app/jobs/points/create_job.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ def perform(params, user_id)
77
data = Points::Params.new(params, user_id).call
88

99
data.each_slice(1000) do |location_batch|
10+
# rubocop:disable Rails/SkipsModelValidations
1011
Point.upsert_all(
1112
location_batch,
1213
unique_by: %i[lonlat timestamp user_id],
1314
returning: false
1415
)
16+
# rubocop:enable Rails/SkipsModelValidations
1517
end
1618
end
1719
end

app/services/overland/points_creator.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ def upsert_points(locations)
3535
created_points = []
3636

3737
locations.each_slice(1000) do |batch|
38+
# rubocop:disable Rails/SkipsModelValidations
3839
result = Point.upsert_all(
3940
batch,
4041
unique_by: %i[lonlat timestamp user_id],
4142
returning: Arel.sql(RETURNING_COLUMNS)
4243
)
44+
# rubocop:enable Rails/SkipsModelValidations
4345
created_points.concat(result) if result
4446
end
4547

app/services/own_tracks/point_creator.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ def upsert_points(locations)
3333
created_points = []
3434

3535
locations.each_slice(1000) do |batch|
36+
# rubocop:disable Rails/SkipsModelValidations
3637
result = Point.upsert_all(
3738
batch,
3839
unique_by: %i[lonlat timestamp user_id],
3940
returning: Arel.sql(RETURNING_COLUMNS)
4041
)
42+
# rubocop:enable Rails/SkipsModelValidations
4143
created_points.concat(result) if result
4244
end
4345

app/services/reverse_geocoding/places/fetch_data.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ def save_places(places_to_create, places_to_update)
153153
updated_at: Time.current
154154
}
155155
end
156+
# rubocop:disable Rails/SkipsModelValidations
156157
Place.upsert_all(update_attributes, unique_by: :id)
158+
# rubocop:enable Rails/SkipsModelValidations
157159
end
158160

159161
def build_point_coordinates(coordinates)

app/services/users/import_data/areas.rb

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def call
1616
valid_areas = filter_and_prepare_areas
1717

1818
if valid_areas.empty?
19-
Rails.logger.info "Areas import completed. Created: 0"
19+
Rails.logger.info 'Areas import completed. Created: 0'
2020
return 0
2121
end
2222

@@ -53,9 +53,7 @@ def filter_and_prepare_areas
5353
valid_areas << prepared_attributes if prepared_attributes
5454
end
5555

56-
if skipped_count > 0
57-
Rails.logger.warn "Skipped #{skipped_count} areas with invalid or missing required data"
58-
end
56+
Rails.logger.warn "Skipped #{skipped_count} areas with invalid or missing required data" if skipped_count > 0
5957

6058
valid_areas
6159
end
@@ -84,7 +82,7 @@ def filter_existing_areas(areas)
8482
existing_areas_lookup[key] = true
8583
end
8684

87-
filtered_areas = areas.reject do |area|
85+
areas.reject do |area|
8886
key = [area[:name], area[:latitude].to_f, area[:longitude].to_f]
8987
if existing_areas_lookup[key]
9088
Rails.logger.debug "Area already exists: #{area[:name]}"
@@ -93,31 +91,28 @@ def filter_existing_areas(areas)
9391
false
9492
end
9593
end
96-
97-
filtered_areas
9894
end
9995

10096
def bulk_import_areas(areas)
10197
total_created = 0
10298

10399
areas.each_slice(BATCH_SIZE) do |batch|
104-
begin
105-
result = Area.upsert_all(
106-
batch,
107-
returning: %w[id],
108-
on_duplicate: :skip
109-
)
110-
111-
batch_created = result.count
112-
total_created += batch_created
113-
114-
Rails.logger.debug "Processed batch of #{batch.size} areas, created #{batch_created}, total created: #{total_created}"
115-
116-
rescue StandardError => e
117-
Rails.logger.error "Failed to process area batch: #{e.message}"
118-
Rails.logger.error "Batch size: #{batch.size}"
119-
Rails.logger.error "Backtrace: #{e.backtrace.first(3).join('\n')}"
120-
end
100+
# rubocop:disable Rails/SkipsModelValidations
101+
result = Area.upsert_all(
102+
batch,
103+
returning: %w[id],
104+
on_duplicate: :skip
105+
)
106+
# rubocop:enable Rails/SkipsModelValidations
107+
108+
batch_created = result.count
109+
total_created += batch_created
110+
111+
Rails.logger.debug "Processed batch of #{batch.size} areas, created #{batch_created}, total created: #{total_created}"
112+
rescue StandardError => e
113+
Rails.logger.error "Failed to process area batch: #{e.message}"
114+
Rails.logger.error "Batch size: #{batch.size}"
115+
Rails.logger.error "Backtrace: #{e.backtrace.first(3).join('\n')}"
121116
end
122117

123118
total_created

app/services/users/import_data/notifications.rb

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ def prepare_notification_attributes(notification_data)
6464

6565
attributes['user_id'] = user.id
6666

67-
unless attributes['created_at'].present?
68-
attributes['created_at'] = Time.current
69-
end
67+
attributes['created_at'] = Time.current unless attributes['created_at'].present?
7068

7169
attributes['updated_at'] = Time.current
7270

@@ -90,7 +88,7 @@ def filter_existing_notifications(notifications)
9088
existing_notifications_lookup[exact_key] = true
9189
end
9290

93-
filtered_notifications = notifications.reject do |notification|
91+
notifications.reject do |notification|
9492
title = notification[:title]&.strip
9593
content = notification[:content]&.strip
9694

@@ -104,8 +102,6 @@ def filter_existing_notifications(notifications)
104102
false
105103
end
106104
end
107-
108-
filtered_notifications
109105
end
110106

111107
def normalize_timestamp(timestamp)
@@ -124,23 +120,22 @@ def bulk_import_notifications(notifications)
124120
total_created = 0
125121

126122
notifications.each_slice(BATCH_SIZE) do |batch|
127-
begin
128-
result = Notification.upsert_all(
129-
batch,
130-
returning: %w[id],
131-
on_duplicate: :skip
132-
)
133-
134-
batch_created = result.count
135-
total_created += batch_created
136-
137-
Rails.logger.debug "Processed batch of #{batch.size} notifications, created #{batch_created}, total created: #{total_created}"
138-
139-
rescue StandardError => e
140-
Rails.logger.error "Failed to process notification batch: #{e.message}"
141-
Rails.logger.error "Batch size: #{batch.size}"
142-
Rails.logger.error "Backtrace: #{e.backtrace.first(3).join('\n')}"
143-
end
123+
# rubocop:disable Rails/SkipsModelValidations
124+
result = Notification.upsert_all(
125+
batch,
126+
returning: %w[id],
127+
on_duplicate: :skip
128+
)
129+
# rubocop:enable Rails/SkipsModelValidations
130+
131+
batch_created = result.count
132+
total_created += batch_created
133+
134+
Rails.logger.debug "Processed batch of #{batch.size} notifications, created #{batch_created}, total created: #{total_created}"
135+
rescue StandardError => e
136+
Rails.logger.error "Failed to process notification batch: #{e.message}"
137+
Rails.logger.error "Batch size: #{batch.size}"
138+
Rails.logger.error "Backtrace: #{e.backtrace.first(3).join('\n')}"
144139
end
145140

146141
total_created

app/services/users/import_data/points.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ def flush_batch
8686
normalized_batch = normalize_point_keys(@buffer)
8787

8888
begin
89+
# rubocop:disable Rails/SkipsModelValidations
8990
result = Point.upsert_all(
9091
normalized_batch,
9192
unique_by: %i[lonlat timestamp user_id],
9293
returning: %w[id],
9394
on_duplicate: :skip
9495
)
96+
# rubocop:enable Rails/SkipsModelValidations
9597

9698
batch_created = result&.count.to_i
9799
@total_created += batch_created

app/services/users/import_data/stats.rb

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def call
1616
valid_stats = filter_and_prepare_stats
1717

1818
if valid_stats.empty?
19-
Rails.logger.info "Stats import completed. Created: 0"
19+
Rails.logger.info 'Stats import completed. Created: 0'
2020
return 0
2121
end
2222

@@ -52,9 +52,7 @@ def filter_and_prepare_stats
5252
valid_stats << prepared_attributes if prepared_attributes
5353
end
5454

55-
if skipped_count > 0
56-
Rails.logger.warn "Skipped #{skipped_count} stats with invalid or missing required data"
57-
end
55+
Rails.logger.warn "Skipped #{skipped_count} stats with invalid or missing required data" if skipped_count > 0
5856

5957
valid_stats
6058
end
@@ -83,7 +81,7 @@ def filter_existing_stats(stats)
8381
existing_stats_lookup[key] = true
8482
end
8583

86-
filtered_stats = stats.reject do |stat|
84+
stats.reject do |stat|
8785
key = [stat[:year], stat[:month]]
8886
if existing_stats_lookup[key]
8987
Rails.logger.debug "Stat already exists: #{stat[:year]}-#{stat[:month]}"
@@ -92,29 +90,26 @@ def filter_existing_stats(stats)
9290
false
9391
end
9492
end
95-
96-
filtered_stats
9793
end
9894

9995
def bulk_import_stats(stats)
10096
total_created = 0
10197

10298
stats.each_slice(BATCH_SIZE) do |batch|
103-
begin
104-
result = Stat.upsert_all(
105-
batch,
106-
returning: %w[id],
107-
on_duplicate: :skip
108-
)
109-
110-
batch_created = result.count
111-
total_created += batch_created
112-
113-
Rails.logger.debug "Processed batch of #{batch.size} stats, created #{batch_created}, total created: #{total_created}"
114-
115-
rescue StandardError => e
116-
ExceptionReporter.call(e, 'Failed to process stat batch')
117-
end
99+
# rubocop:disable Rails/SkipsModelValidations
100+
result = Stat.upsert_all(
101+
batch,
102+
returning: %w[id],
103+
on_duplicate: :skip
104+
)
105+
# rubocop:enable Rails/SkipsModelValidations
106+
107+
batch_created = result.count
108+
total_created += batch_created
109+
110+
Rails.logger.debug "Processed batch of #{batch.size} stats, created #{batch_created}, total created: #{total_created}"
111+
rescue StandardError => e
112+
ExceptionReporter.call(e, 'Failed to process stat batch')
118113
end
119114

120115
total_created

0 commit comments

Comments
 (0)