Skip to content

Commit

Permalink
Merge pull request #436 from wri/chore/rails-7
Browse files Browse the repository at this point in the history
Chore/rails 7
  • Loading branch information
tsubik committed Apr 17, 2023
2 parents c401b3a + de238a9 commit 6654444
Show file tree
Hide file tree
Showing 26 changed files with 431 additions and 542 deletions.
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ gem "paranoia", "~> 2.5.3"
# Rails and DB
gem "activerecord-postgis-adapter"
gem "pg"
gem "rails", "~> 6.1.7"
gem "rails", "~> 7.0.4"
gem "rgeo"
gem "rgeo-geojson"

Expand Down Expand Up @@ -118,13 +118,12 @@ group :development do
gem "capistrano-passenger"
gem "capistrano-rails", "~> 1.2"
gem "capistrano-rvm"
gem "guard"
gem "i18n_generators"
gem "listen", "~> 3.3"
# Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
gem "rack-mini-profiler", "~> 2.0"
gem "spring"
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
gem "web-console", ">= 4.1.0"
end

Expand Down
168 changes: 72 additions & 96 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,47 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.3)
actionpack (= 6.1.7.3)
activesupport (= 6.1.7.3)
actioncable (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.3)
actionpack (= 6.1.7.3)
activejob (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
actionmailbox (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (>= 2.7.1)
actionmailer (6.1.7.3)
actionpack (= 6.1.7.3)
actionview (= 6.1.7.3)
activejob (= 6.1.7.3)
activesupport (= 6.1.7.3)
net-imap
net-pop
net-smtp
actionmailer (7.0.4.3)
actionpack (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.3)
actionview (= 6.1.7.3)
activesupport (= 6.1.7.3)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.4.3)
actionview (= 7.0.4.3)
activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.3)
actionpack (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
actiontext (7.0.4.3)
actionpack (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.3)
activesupport (= 6.1.7.3)
actionview (7.0.4.3)
activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
Expand Down Expand Up @@ -107,35 +114,34 @@ GEM
xdan-datetimepicker-rails (~> 2.5.1)
activeadmin_quill_editor (1.0.0)
activeadmin (~> 2.0)
activejob (6.1.7.3)
activesupport (= 6.1.7.3)
activejob (7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.3.6)
activemodel (6.1.7.3)
activesupport (= 6.1.7.3)
activerecord (6.1.7.3)
activemodel (= 6.1.7.3)
activesupport (= 6.1.7.3)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activerecord-import (1.4.1)
activerecord (>= 4.2)
activerecord-postgis-adapter (7.1.1)
activerecord (~> 6.1)
activerecord-postgis-adapter (8.0.1)
activerecord (~> 7.0.0)
rgeo-activerecord (~> 7.0.0)
activestorage (6.1.7.3)
actionpack (= 6.1.7.3)
activejob (= 6.1.7.3)
activerecord (= 6.1.7.3)
activesupport (= 6.1.7.3)
activestorage (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activesupport (= 7.0.4.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.3)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
acts_as_list (1.1.0)
activerecord (>= 4.2)
addressable (2.8.3)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
airbrussh (1.4.1)
sshkit (>= 1.6.1, != 1.7.0)
Expand Down Expand Up @@ -201,7 +207,6 @@ GEM
mime-types (~> 3.0)
chartkick (5.0.1)
choice (0.2.0)
coderay (1.1.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.0)
countries (5.3.2)
Expand Down Expand Up @@ -253,7 +258,6 @@ GEM
webrick (~> 1.7)
websocket-driver (>= 0.6, < 0.8)
ffi (1.15.5)
formatador (1.1.0)
formtastic (4.0.0)
actionpack (>= 5.2.0)
formtastic_i18n (0.7.0)
Expand All @@ -265,15 +269,6 @@ GEM
request_store (~> 1.0)
groupdate (6.2.0)
activesupport (>= 5.2)
guard (2.18.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.13.0)
shellany (~> 0.0)
thor (>= 0.18.1)
has_scope (0.8.1)
actionpack (>= 5.2)
activesupport (>= 5.2)
Expand All @@ -294,7 +289,7 @@ GEM
responders (>= 2, < 4)
interactor (3.1.2)
io-console (0.6.0)
irb (1.6.3)
irb (1.6.4)
reline (>= 0.3.0)
jquery-rails (4.5.1)
rails-dom-testing (>= 1, < 3)
Expand Down Expand Up @@ -328,13 +323,9 @@ GEM
letter_opener (~> 1.7)
railties (>= 5.2)
rexml
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.20.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.2.8)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
Expand All @@ -352,7 +343,6 @@ GEM
minitest (5.18.0)
msgpack (1.7.0)
mustache (1.1.1)
nenv (0.3.0)
net-imap (0.3.4)
date
net-protocol
Expand All @@ -366,15 +356,12 @@ GEM
net-protocol
net-ssh (7.1.0)
nio4r (2.5.9)
nokogiri (1.14.2)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.14.2-x86_64-linux)
nokogiri (1.14.3-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
oj (3.14.2)
oj (3.14.3)
oj_mimic_json (1.0.1)
optimist (3.0.1)
orm_adapter (0.5.0)
Expand All @@ -389,9 +376,6 @@ GEM
patience_diff (1.2.0)
optimist (~> 3.0)
pg (1.4.6)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.1)
puma (6.2.1)
nio4r (~> 2.0)
Expand All @@ -401,25 +385,24 @@ GEM
rack (>= 2.0.0)
rack-mini-profiler (2.3.4)
rack (>= 1.2.0)
rack-protection (3.0.5)
rack-protection (3.0.6)
rack
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.3)
actioncable (= 6.1.7.3)
actionmailbox (= 6.1.7.3)
actionmailer (= 6.1.7.3)
actionpack (= 6.1.7.3)
actiontext (= 6.1.7.3)
actionview (= 6.1.7.3)
activejob (= 6.1.7.3)
activemodel (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
rails (7.0.4.3)
actioncable (= 7.0.4.3)
actionmailbox (= 7.0.4.3)
actionmailer (= 7.0.4.3)
actionpack (= 7.0.4.3)
actiontext (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activemodel (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
bundler (>= 1.15.0)
railties (= 6.1.7.3)
sprockets-rails (>= 2.0.0)
railties (= 7.0.4.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand All @@ -430,21 +413,19 @@ GEM
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
railties (6.1.7.3)
actionpack (= 6.1.7.3)
activesupport (= 6.1.7.3)
railties (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
ransack (3.2.1)
activerecord (>= 6.1.5)
activesupport (>= 6.1.5)
i18n
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.5.1)
redis-actionpack (5.3.0)
actionpack (>= 5, < 8)
Expand Down Expand Up @@ -522,7 +503,7 @@ GEM
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.18.0)
rubocop-rails (2.19.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
Expand Down Expand Up @@ -557,7 +538,6 @@ GEM
sentry-ruby (~> 5.8.0)
sentry-ruby (5.8.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
shellany (0.0.1)
shoulda-matchers (4.0.1)
activesupport (>= 4.2.0)
sidekiq (5.2.10)
Expand All @@ -571,7 +551,6 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
spring (4.1.1)
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand Down Expand Up @@ -671,13 +650,11 @@ DEPENDENCIES
globalize
globalize-versioning!
groupdate
guard
i18n_generators
interactor (~> 3.0)
jsonapi-resources (= 0.9.12)
jwt
letter_opener_web
listen (~> 3.3)
mini_magick
oj
oj_mimic_json
Expand All @@ -687,7 +664,7 @@ DEPENDENCIES
puma
rack-cors
rack-mini-profiler (~> 2.0)
rails (~> 6.1.7)
rails (~> 7.0.4)
rails-erd
redis-rails
rgeo
Expand All @@ -709,7 +686,6 @@ DEPENDENCIES
shoulda-matchers (~> 4.0.1)
sidekiq (~> 5)
simplecov
spring
standard
super_diff
tzinfo-data
Expand Down
6 changes: 3 additions & 3 deletions app/models/observation_report_statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ObservationReportStatistic < ApplicationRecord

def self.from_date(date)
date_obj = date.respond_to?(:strftime) ? date : Date.parse(date)
from_date_sql = where("date > '#{date_obj.to_s(:db)}'").to_sql
from_date_sql = where("date > '#{date_obj.to_fs(:db)}'").to_sql
first_rows_sql = at_date(date_obj).to_sql

from("(#{from_date_sql} UNION #{first_rows_sql}) as observation_report_statistics")
Expand All @@ -35,7 +35,7 @@ def self.at_date(date)
query = <<~SQL
(select
id,
'#{date_obj.to_s(:db)}'::date as date,
'#{date_obj.to_fs(:db)}'::date as date,
country_id,
observer_id,
total_count,
Expand All @@ -44,7 +44,7 @@ def self.at_date(date)
from
(select row_number() over (partition by country_id, observer_id order by date desc), *
from observation_report_statistics ors
where date <= '#{date_obj.to_s(:db)}'
where date <= '#{date_obj.to_fs(:db)}'
) as stats_by_date
where stats_by_date.row_number = 1
) as observation_report_statistics
Expand Down
Loading

0 comments on commit 6654444

Please sign in to comment.