Skip to content

Commit

Permalink
Ignore raw_data column during requests to imports and points ta…
Browse files Browse the repository at this point in the history
…bles
  • Loading branch information
Freika committed May 19, 2024
1 parent dd0ec05 commit cb21fbc
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .app_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.3
0.2.4
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
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

### Added
Expand Down
15 changes: 15 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,19 @@ def app_version
def app_theme
current_user&.theme == 'light' ? 'light' : 'dark'
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
2 changes: 2 additions & 0 deletions app/models/import.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

class Import < ApplicationRecord
self.ignored_columns = %w[raw_data]

belongs_to :user
has_many :points, dependent: :destroy

Expand Down
2 changes: 2 additions & 0 deletions app/models/point.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Point < ApplicationRecord
self.ignored_columns = %w[raw_data]

belongs_to :import, optional: true

validates :latitude, :longitude, :timestamp, presence: true
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_right_sidebar.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= "#{@distance} km" if @distance %>
<%= sidebar_distance(@distance) %> <%= sidebar_points(@points) %>

<div id='years-nav'>
<div class="dropdown">
Expand Down

0 comments on commit cb21fbc

Please sign in to comment.