Ignore raw_data column during requests to imports and points tables

This commit is contained in:
Eugene Burmakin 2024-05-19 18:26:48 +02:00
parent dd0ec059a3
commit cb21fbcf54
6 changed files with 34 additions and 2 deletions

View file

@ -1 +1 @@
0.2.3 0.2.4

View file

@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.2.4] — 2024-05-19
### Added
- In right sidebar you can now see the total amount of geopoints aside of kilometers traveled
### Fixed
- Improved overall performance if the application by ignoring `raw_data` column during requests to `imports` and `points` tables.
---
## [0.2.3] — 2024-05-18 ## [0.2.3] — 2024-05-18
### Added ### Added

View file

@ -72,4 +72,19 @@ module ApplicationHelper
def app_theme def app_theme
current_user&.theme == 'light' ? 'light' : 'dark' current_user&.theme == 'light' ? 'light' : 'dark'
end end
def sidebar_distance(distance)
return unless distance
"#{distance} km"
end
def sidebar_points(points)
return unless points
points_number = points.size
points_pluralized = pluralize(points_number, 'point')
"(#{points_pluralized})"
end
end end

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
class Import < ApplicationRecord class Import < ApplicationRecord
self.ignored_columns = %w[raw_data]
belongs_to :user belongs_to :user
has_many :points, dependent: :destroy has_many :points, dependent: :destroy

View file

@ -1,4 +1,6 @@
class Point < ApplicationRecord class Point < ApplicationRecord
self.ignored_columns = %w[raw_data]
belongs_to :import, optional: true belongs_to :import, optional: true
validates :latitude, :longitude, :timestamp, presence: true validates :latitude, :longitude, :timestamp, presence: true

View file

@ -1,4 +1,4 @@
<%= "#{@distance} km" if @distance %> <%= sidebar_distance(@distance) %> <%= sidebar_points(@points) %>
<div id='years-nav'> <div id='years-nav'>
<div class="dropdown"> <div class="dropdown">