Compare commits

...

2 commits

Author SHA1 Message Date
Eugene Burmakin
358cda922e Fix settings page 2025-12-28 13:40:16 +01:00
Eugene Burmakin
727a4df2e4 Change Digests Distance to Bigint 2025-12-27 23:49:53 +01:00
6 changed files with 22 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -77,7 +77,7 @@
<div class="form-control"> <div class="form-control">
<label class="label cursor-pointer justify-start gap-4"> <label class="label cursor-pointer justify-start gap-4">
<%= f.check_box :digest_emails_enabled, <%= f.check_box :digest_emails_enabled,
checked: current_user.safe_settings.digest_emails_enabled, checked: current_user.safe_settings.digest_emails_enabled?,
class: "toggle toggle-primary" %> class: "toggle toggle-primary" %>
<div> <div>
<span class="label-text font-medium">Year-End Digest Emails</span> <span class="label-text font-medium">Year-End Digest Emails</span>

View file

@ -3,8 +3,10 @@
<div class="w-full my-5"> <div class="w-full my-5">
<div class="flex justify-between items-center mb-6"> <div class="flex justify-between items-center mb-6">
<h1 class="text-3xl font-bold">Statistics</h1> <h1 class="text-3xl font-bold">Statistics</h1>
<%= link_to users_digests_path, class: 'btn btn-outline btn-sm' do %> <% if Date.today >= Date.new(2025, 12, 31) %>
<%= icon 'earth' %> Year-End Digests <%= link_to users_digests_path, class: 'btn btn-outline btn-sm' do %>
<%= icon 'earth' %> Year-End Digests
<% end %>
<% end %> <% end %>
</div> </div>

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
class ChangeDigestsDistanceToBigint < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def up
safety_assured { change_column :digests, :distance, :bigint, null: false, default: 0 }
end
def down
safety_assured { change_column :digests, :distance, :integer, null: false, default: 0 }
end
end

4
db/schema.rb generated
View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_12_27_000001) do ActiveRecord::Schema[8.0].define(version: 2025_12_27_223614) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql" enable_extension "pg_catalog.plpgsql"
enable_extension "postgis" enable_extension "postgis"
@ -84,7 +84,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_27_000001) do
t.bigint "user_id", null: false t.bigint "user_id", null: false
t.integer "year", null: false t.integer "year", null: false
t.integer "period_type", default: 0, null: false t.integer "period_type", default: 0, null: false
t.integer "distance", default: 0, null: false t.bigint "distance", default: 0, null: false
t.jsonb "toponyms", default: {} t.jsonb "toponyms", default: {}
t.jsonb "monthly_distances", default: {} t.jsonb "monthly_distances", default: {}
t.jsonb "time_spent_by_location", default: {} t.jsonb "time_spent_by_location", default: {}

View file

@ -46,7 +46,7 @@ if Tag.none?
{ name: 'Home', color: '#FF5733', icon: '🏡' }, { name: 'Home', color: '#FF5733', icon: '🏡' },
{ name: 'Work', color: '#33FF57', icon: '💼' }, { name: 'Work', color: '#33FF57', icon: '💼' },
{ name: 'Favorite', color: '#3357FF', icon: '⭐' }, { name: 'Favorite', color: '#3357FF', icon: '⭐' },
{ name: 'Travel Plans', color: '#F1C40F', icon: '🗺️' }, { name: 'Travel Plans', color: '#F1C40F', icon: '🗺️' }
] ]
User.find_each do |user| User.find_each do |user|