diff --git a/Gemfile b/Gemfile index 8639ef0986..052cad98e5 100644 --- a/Gemfile +++ b/Gemfile @@ -55,6 +55,7 @@ gem "languagetool-widget"#, path: "../../noesya/languagetool-widget" gem "leaflet-rails" gem "libretranslate"#, path: "../libretranslate" gem "lucide-rails" +gem "minitest", "< 6" # TODO Seb : Upgrade en Rails 8.1.2 gem "metainspector", git: "https://github.com/jaimeiniesta/metainspector.git" gem "octokit" gem "omniauth-saml", "~> 2" diff --git a/Gemfile.lock b/Gemfile.lock index 352a90fa6a..13ea0cb104 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -139,14 +139,12 @@ GEM tzinfo-data (~> 1.2020) addressable (2.9.0) public_suffix (>= 2.0.2, < 8.0) - annotaterb (4.22.0) + annotaterb (4.20.0) activerecord (>= 6.0.0) activesupport (>= 6.0.0) - auth-sanitizer (0.1.4) - version_gem (~> 1.1, >= 1.1.9) aws-eventstream (1.4.0) - aws-partitions (1.1253.0) - aws-sdk-core (3.249.0) + aws-partitions (1.1209.0) + aws-sdk-core (3.241.4) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) @@ -154,26 +152,26 @@ GEM bigdecimal jmespath (~> 1, >= 1.6.1) logger - aws-sdk-kms (1.128.0) - aws-sdk-core (~> 3, >= 3.248.0) + aws-sdk-kms (1.121.0) + aws-sdk-core (~> 3, >= 3.241.4) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.224.0) - aws-sdk-core (~> 3, >= 3.248.0) + aws-sdk-s3 (1.212.0) + aws-sdk-core (~> 3, >= 3.241.4) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) aws-sigv4 (1.12.1) aws-eventstream (~> 1, >= 1.0.2) base64 (0.3.0) - bcrypt (3.1.22) + bcrypt (3.1.21) better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) rouge (>= 1.0.0) - bigdecimal (4.1.2) + bigdecimal (4.0.1) bindex (0.8.1) - binding_of_caller (2.0.0) + binding_of_caller (1.0.1) debug_inspector (>= 1.2.0) - bootsnap (1.24.5) + bootsnap (1.21.1) msgpack (~> 1.2) bootstrap (5.3.8) popper_js (>= 2.11.8, < 3) @@ -186,7 +184,7 @@ GEM addressable (~> 2.3, >= 2.3.0) json (~> 2.1, >= 2.1.0) typhoeus (~> 1.0, >= 1.0.1) - bugsnag (6.30.0) + bugsnag (6.29.0) concurrent-ruby (~> 1.0) builder (3.3.0) byebug (13.0.0) @@ -201,15 +199,15 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - caxlsx (4.4.2) + caxlsx (4.4.1) htmlentities (~> 4.3, >= 4.3.4) marcel (~> 1.0) nokogiri (~> 1.10, >= 1.10.4) rubyzip (>= 2.4, < 4) - caxlsx_rails (0.7.1) - actionpack (>= 6.1) - caxlsx (>= 4.0) - cgi (0.5.1) + caxlsx_rails (0.6.4) + actionpack (>= 3.1) + caxlsx (>= 3.0) + cgi (0.5.2) chartkick (5.2.1) citeproc (1.1.0) date @@ -251,14 +249,14 @@ GEM rails-html-sanitizer date (3.5.1) debug_inspector (1.2.0) - devise (5.0.4) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 7.0) + railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.16.0) - devise (>= 5.0.0) + devise-i18n (1.15.0) + devise (>= 4.9.0) rails-i18n diff-lcs (1.6.2) docile (1.4.1) @@ -267,18 +265,17 @@ GEM encryptor (3.0.0) enum_help (0.0.20) activesupport (>= 3.0.0) - erb (6.0.4) + erb (6.0.1) erubi (1.13.1) et-orbi (1.4.0) tzinfo - ethon (0.18.0) + ethon (0.15.0) ffi (>= 1.15.0) - logger - execjs (2.10.1) + execjs (2.10.0) faceted_search (3.6.4) font-awesome-sass rails (>= 5.2.0) - faraday (2.14.2) + faraday (2.14.0) faraday-net_http (>= 2.0, < 3.5) json logger @@ -292,24 +289,24 @@ GEM faraday-gzip (3.1.0) faraday (>= 2.0, < 3) zlib (~> 3.0) - faraday-http-cache (2.7.0) + faraday-http-cache (2.6.1) faraday (>= 0.8) faraday-multipart (1.2.0) multipart-post (~> 2.0) - faraday-net_http (3.4.3) + faraday-net_http (3.4.2) net-http (~> 0.5) faraday-retry (2.4.0) faraday (~> 2.0) - fastimage (2.4.1) - ffi (1.17.4-arm64-darwin) - ffi (1.17.4-x86_64-darwin) - ffi (1.17.4-x86_64-linux-gnu) + fastimage (2.4.0) + ffi (1.17.3-arm64-darwin) + ffi (1.17.3-x86_64-darwin) + ffi (1.17.3-x86_64-linux-gnu) figaro (1.3.0) thor (>= 0.14.0, < 2) font-awesome-sass (6.7.2) sassc (~> 2.0) forwardable (1.4.0) - fugit (1.12.2) + fugit (1.12.1) et-orbi (~> 1.4) raabro (~> 1.4) geo_calc (0.7.8) @@ -335,23 +332,26 @@ GEM terminal-table (>= 1.5.1) globalid (1.3.0) activesupport (>= 6.1) - good_job (4.19.0) + good_job (4.13.1) activejob (>= 6.1.0) activerecord (>= 6.1.0) concurrent-ruby (>= 1.3.1) fugit (>= 1.11.0) railties (>= 6.1.0) thor (>= 1.0.0) - google-protobuf (4.35.0-arm64-darwin) + google-protobuf (4.33.4) + bigdecimal + rake (>= 13) + google-protobuf (4.33.4-arm64-darwin) bigdecimal - rake (~> 13.3) - google-protobuf (4.35.0-x86_64-darwin) + rake (>= 13) + google-protobuf (4.33.4-x86_64-darwin) bigdecimal - rake (~> 13.3) - google-protobuf (4.35.0-x86_64-linux-gnu) + rake (>= 13) + google-protobuf (4.33.4-x86_64-linux-gnu) bigdecimal - rake (~> 13.3) - hal_openscience (1.0.0) + rake (>= 13) + hal_openscience (0.1.0) json net-http open-uri @@ -359,7 +359,7 @@ GEM hashie (5.1.0) logger htmlentities (4.4.2) - http-cookie (1.1.6) + http-cookie (1.1.0) domain_name (~> 0.5) httparty (0.24.2) csv @@ -374,16 +374,17 @@ GEM i18n_date_range (2.1.2) rails rails-i18n - image_processing (2.0.1) + image_processing (1.14.0) + mini_magick (>= 4.9.5, < 6) + ruby-vips (>= 2.0.17, < 3) invisible_captcha (2.3.0) rails (>= 5.2) io-console (0.8.2) - irb (1.18.0) + irb (1.16.0) pp (>= 0.6.0) - prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - jbuilder (2.15.1) + jbuilder (2.14.1) actionview (>= 7.0.0) activesupport (>= 7.0.0) jmespath (1.6.2) @@ -395,11 +396,11 @@ GEM railties (>= 3.2.16) jsbundling-rails (1.3.1) railties (>= 6.0.0) - json (2.19.6) - json-schema (6.2.0) + json (2.18.0) + json-schema (6.1.0) addressable (~> 2.8) bigdecimal (>= 3.1, < 5) - jwt (3.2.0) + jwt (3.1.2) base64 kamifusen (1.13.2) image_processing @@ -430,10 +431,10 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logger (1.7.0) - loofah (2.25.1) + loofah (2.25.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lucide-rails (0.7.4) + lucide-rails (0.7.3) railties (>= 4.1.0) mail (2.9.0) logger @@ -441,14 +442,14 @@ GEM net-imap net-pop net-smtp - marcel (1.2.1) + marcel (1.1.0) matrix (0.4.3) + mini_magick (5.3.1) + logger mini_mime (1.1.5) - minitest (6.0.6) - drb (~> 2.0) - prism (~> 1.5) - msgpack (1.8.1) - multi_xml (0.9.1) + minitest (5.27.0) + msgpack (1.8.0) + multi_xml (0.8.1) bigdecimal (>= 3.1, < 5) multipart-post (2.4.1) mutex_m (0.3.0) @@ -457,7 +458,7 @@ GEM nesty (1.0.2) net-http (0.9.1) uri (>= 0.11.1) - net-imap (0.6.4) + net-imap (0.6.2) date net-protocol net-pop (0.1.2) @@ -467,31 +468,26 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.5) - nokogiri (1.19.3-arm64-darwin) + nokogiri (1.19.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.19.3-x86_64-darwin) + nokogiri (1.19.4-x86_64-darwin) racc (~> 1.4) - nokogiri (1.19.3-x86_64-linux-gnu) + nokogiri (1.19.4-x86_64-linux-gnu) racc (~> 1.4) - oauth (1.1.5) - auth-sanitizer (~> 0.1, >= 0.1.3) + oauth (1.1.3) base64 (~> 0.1) - cgi - oauth-tty (~> 1.0, >= 1.0.8) - snaky_hash (~> 2.0, >= 2.0.4) + oauth-tty (~> 1.0, >= 1.0.6) + snaky_hash (~> 2.0) version_gem (~> 1.1, >= 1.1.9) - oauth-tty (1.0.8) - auth-sanitizer (~> 0.1, >= 0.1.3) - cgi + oauth-tty (1.0.6) version_gem (~> 1.1, >= 1.1.9) - oauth2 (2.0.20) - auth-sanitizer (~> 0.1, >= 0.1.3) + oauth2 (2.0.18) faraday (>= 0.17.3, < 4.0) jwt (>= 1.0, < 4.0) logger (~> 1.2) multi_xml (~> 0.5) rack (>= 1.2, < 4) - snaky_hash (~> 2.0, >= 2.0.4) + snaky_hash (~> 2.0, >= 2.0.3) version_gem (~> 1.1, >= 1.1.9) observer (0.1.2) octokit (10.0.0) @@ -502,7 +498,7 @@ GEM logger rack (>= 2.2.3) rack-protection - omniauth-saml (2.2.5) + omniauth-saml (2.2.4) omniauth (~> 2.1) ruby-saml (~> 1.18) open-uri (0.5.0) @@ -519,31 +515,30 @@ GEM pg (1.6.3-arm64-darwin) pg (1.6.3-x86_64-darwin) pg (1.6.3-x86_64-linux) - pg_query (6.2.2) + pg_query (6.2.1) google-protobuf (>= 3.25.3) - pghero (3.8.0) - activerecord (>= 7.2) + pghero (3.7.0) + activerecord (>= 7.1) popper_js (2.11.8) pp (0.6.3) prettyprint prettyprint (0.2.0) - prism (1.9.0) psych (5.3.1) date stringio - public_suffix (7.0.5) - puma (8.0.2) + public_suffix (7.0.2) + puma (7.2.0) nio4r (~> 2.0) raabro (1.4.0) racc (1.8.1) - rack (3.2.6) + rack (3.2.4) rack-mini-profiler (3.3.1) rack (>= 1.2.0) rack-protection (4.2.1) base64 (>= 0.1.0) logger (>= 1.6.0) rack (>= 3.0.0, < 4) - rack-session (2.1.2) + rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) rack-test (2.2.0) @@ -571,8 +566,8 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.7.0) - loofah (~> 2.25) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails-i18n (8.1.0) i18n (>= 0.7, < 2) @@ -586,22 +581,22 @@ GEM thor (~> 1.0, >= 1.2.2) tsort (>= 0.2) zeitwerk (~> 2.6) - rake (13.4.2) + rake (13.3.1) randexp (0.1.7) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) rbnacl (7.1.2) ffi (~> 1) - rdoc (7.2.0) + rdoc (7.1.0) erb psych (>= 4.0.0) tsort redis (5.4.1) redis-client (>= 0.22.0) - redis-client (0.29.0) + redis-client (0.26.3) connection_pool - regexp_parser (2.12.0) + regexp_parser (2.11.3) reline (0.6.3) io-console (~> 0.5) requests (1.0.2) @@ -614,25 +609,24 @@ GEM nokogiri (~> 1) rubyzip (>= 1.3.0, < 3.0.0) rotp (6.3.0) - rouge (5.0.0) - strscan (~> 3.1) + rouge (4.7.0) rspec-core (3.13.6) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.8) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (8.0.4) + rspec-rails (8.0.2) actionpack (>= 7.2) activesupport (>= 7.2) railties (>= 7.2) - rspec-core (>= 3.13.0, < 5.0.0) - rspec-expectations (>= 3.13.0, < 5.0.0) - rspec-mocks (>= 3.13.0, < 5.0.0) - rspec-support (>= 3.13.0, < 5.0.0) - rspec-support (3.13.7) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.6) rswag (2.17.0) rswag-api (= 2.17.0) rswag-specs (= 2.17.0) @@ -674,17 +668,16 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - set (1.1.3) - simple-navigation (4.4.1) + set (1.1.2) + simple-navigation (4.4.0) activesupport (>= 2.3.2) - ostruct simple_form (5.4.1) actionpack (>= 7.0) activemodel (>= 7.0) - simple_form_bs5_file_input (0.3.1) + simple_form_bs5_file_input (0.3.0) rails simple_form - simple_form_password_with_hints (0.0.12) + simple_form_password_with_hints (0.0.10) rails simple_form simple_po_parser (1.1.6) @@ -695,10 +688,10 @@ GEM simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) singleton (0.3.0) - snaky_hash (2.0.4) + snaky_hash (2.0.3) hashie (>= 0.1.0, < 6) version_gem (>= 1.1.8, < 3) - spring (4.6.0) + spring (4.4.0) sprockets (4.2.2) concurrent-ruby (~> 1.0) logger @@ -708,7 +701,6 @@ GEM activesupport (>= 6.1) sprockets (>= 3.0.0) stringio (3.2.0) - strscan (3.1.8) sugar-high (0.7.3) sweetloader (0.1.6) activesupport (>= 3.0.1) @@ -719,13 +711,13 @@ GEM tilt (2.7.0) time (0.4.2) date - timeout (0.6.1) + timeout (0.6.0) tsort (0.2.0) - typhoeus (1.6.0) - ethon (>= 0.18.0) + typhoeus (1.5.0) + ethon (>= 0.9.0, < 0.16.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - tzinfo-data (1.2026.2) + tzinfo-data (1.2025.3) tzinfo (>= 1.0.0) unaccent (0.4.0) unicode-display_width (3.2.0) @@ -743,15 +735,16 @@ GEM oauth (>= 0.4.3) warden (1.2.9) rack (>= 2.0.9) - web-console (4.3.0) - actionview (>= 8.0.0) + web-console (4.2.1) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) bindex (>= 0.4.0) - railties (>= 8.0.0) + railties (>= 6.0.0) webdrivers (5.3.1) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0, < 4.11) - webmock (3.26.2) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -762,8 +755,8 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.8.2) - zlib (3.2.3) + zeitwerk (2.7.4) + zlib (3.2.2) PLATFORMS arm64-darwin-23 @@ -829,6 +822,7 @@ DEPENDENCIES listen (~> 3.3) lucide-rails metainspector! + minitest (< 6) mutex_m (~> 0.3.0) octokit omniauth-saml (~> 2) @@ -871,7 +865,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 4.0.3 + ruby 4.0.3p0 BUNDLED WITH - 4.0.11 + 2.7.2 diff --git a/app/models/university/organization.rb b/app/models/university/organization.rb index 7a9a68d5ba..64510c0b1c 100644 --- a/app/models/university/organization.rb +++ b/app/models/university/organization.rb @@ -9,6 +9,9 @@ # country :string # deleted_at :datetime # email :string +# is_laboratory :boolean default(FALSE) +# is_location :boolean default(FALSE) +# is_school :boolean default(FALSE) # kind :integer default("company") # latitude :float # longitude :float @@ -47,6 +50,7 @@ class University::Organization < ApplicationRecord include Sanitizable include Searchable include WithCountry + include WithFacets include WithGeolocation include WithKind include WithOpenApi diff --git a/app/models/university/organization/localization/laboratory.rb b/app/models/university/organization/localization/laboratory.rb new file mode 100644 index 0000000000..0b327e0fdf --- /dev/null +++ b/app/models/university/organization/localization/laboratory.rb @@ -0,0 +1,72 @@ +# == Schema Information +# +# Table name: university_organization_localizations +# +# id :uuid not null, primary key +# address_additional :string +# address_name :string +# deleted_at :datetime +# featured_image_alt :string +# featured_image_credit :text +# linkedin :string +# long_name :string +# mastodon :string +# meta_description :text +# migration_identifier :string +# name :string +# published :boolean default(TRUE) +# published_at :datetime +# slug :string +# summary :text +# text :text +# twitter :string +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid uniquely indexed => [language_id], indexed +# language_id :uuid uniquely indexed => [about_id], indexed +# university_id :uuid indexed +# +# Indexes +# +# idx_on_about_id_language_id_eb921fd47b (about_id,language_id) UNIQUE +# index_university_organization_localizations_on_about_id (about_id) +# index_university_organization_localizations_on_language_id (language_id) +# index_university_organization_localizations_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_19fb4f0718 (about_id => university_organizations.id) +# fk_rails_4b46ee9073 (language_id => languages.id) +# fk_rails_ba221edb00 (university_id => universities.id) +# +class University::Organization::Localization::Laboratory < University::Organization::Localization + def self.polymorphic_name + 'University::Organization::Localization::Laboratory' + end + + def git_path_relative + "laboratories/#{slug}/_index.html" + end + + def template_static + "admin/university/organizations/laboratories/static" + end + + def dependencies + [ + organization_l10n, + organization + ] + end + + def references + # TODO + end + + def static_localization_key + # so we don't mess with the University::Organization::Localization static_localization_key + "#{about.class.polymorphic_name.parameterize}-laboratory-#{self.about_id}" + end + +end diff --git a/app/models/university/organization/localization/location.rb b/app/models/university/organization/localization/location.rb new file mode 100644 index 0000000000..af3c248fa2 --- /dev/null +++ b/app/models/university/organization/localization/location.rb @@ -0,0 +1,72 @@ +# == Schema Information +# +# Table name: university_organization_localizations +# +# id :uuid not null, primary key +# address_additional :string +# address_name :string +# deleted_at :datetime +# featured_image_alt :string +# featured_image_credit :text +# linkedin :string +# long_name :string +# mastodon :string +# meta_description :text +# migration_identifier :string +# name :string +# published :boolean default(TRUE) +# published_at :datetime +# slug :string +# summary :text +# text :text +# twitter :string +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid uniquely indexed => [language_id], indexed +# language_id :uuid uniquely indexed => [about_id], indexed +# university_id :uuid indexed +# +# Indexes +# +# idx_on_about_id_language_id_eb921fd47b (about_id,language_id) UNIQUE +# index_university_organization_localizations_on_about_id (about_id) +# index_university_organization_localizations_on_language_id (language_id) +# index_university_organization_localizations_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_19fb4f0718 (about_id => university_organizations.id) +# fk_rails_4b46ee9073 (language_id => languages.id) +# fk_rails_ba221edb00 (university_id => universities.id) +# +class University::Organization::Localization::Location < University::Organization::Localization + def self.polymorphic_name + 'University::Organization::Localization::Location' + end + + def git_path_relative + "locations/#{slug}/_index.html" + end + + def template_static + "admin/university/organizations/locations/static" + end + + def dependencies + [ + organization_l10n, + organization + ] + end + + def references + # TODO + end + + def static_localization_key + # so we don't mess with the University::Organization::Localization static_localization_key + "#{about.class.polymorphic_name.parameterize}-location-#{self.about_id}" + end + +end diff --git a/app/models/university/organization/localization/school.rb b/app/models/university/organization/localization/school.rb new file mode 100644 index 0000000000..6e96a9bbae --- /dev/null +++ b/app/models/university/organization/localization/school.rb @@ -0,0 +1,72 @@ +# == Schema Information +# +# Table name: university_organization_localizations +# +# id :uuid not null, primary key +# address_additional :string +# address_name :string +# deleted_at :datetime +# featured_image_alt :string +# featured_image_credit :text +# linkedin :string +# long_name :string +# mastodon :string +# meta_description :text +# migration_identifier :string +# name :string +# published :boolean default(TRUE) +# published_at :datetime +# slug :string +# summary :text +# text :text +# twitter :string +# url :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid uniquely indexed => [language_id], indexed +# language_id :uuid uniquely indexed => [about_id], indexed +# university_id :uuid indexed +# +# Indexes +# +# idx_on_about_id_language_id_eb921fd47b (about_id,language_id) UNIQUE +# index_university_organization_localizations_on_about_id (about_id) +# index_university_organization_localizations_on_language_id (language_id) +# index_university_organization_localizations_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_19fb4f0718 (about_id => university_organizations.id) +# fk_rails_4b46ee9073 (language_id => languages.id) +# fk_rails_ba221edb00 (university_id => universities.id) +# +class University::Organization::Localization::School < University::Organization::Localization + def self.polymorphic_name + 'University::Organization::Localization::School' + end + + def git_path_relative + "schools/#{slug}/_index.html" + end + + def template_static + "admin/university/organizations/schools/static" + end + + def dependencies + [ + organization_l10n, + organization + ] + end + + def references + # TODO + end + + def static_localization_key + # so we don't mess with the University::Organization::Localization static_localization_key + "#{about.class.polymorphic_name.parameterize}-school-#{self.about_id}" + end + +end diff --git a/app/models/university/organization/with_facets.rb b/app/models/university/organization/with_facets.rb new file mode 100644 index 0000000000..fc71b00310 --- /dev/null +++ b/app/models/university/organization/with_facets.rb @@ -0,0 +1,17 @@ +module University::Organization::WithFacets + extend ActiveSupport::Concern + + included do + LIST_OF_FACETS = [ + :location, + :school, + :laboratory + ].freeze + + scope :locations, -> { where(is_location: true) } + scope :schools, -> { where(is_school: true) } + scope :laboratories, -> { where(is_laboratory: true) } + # Filters + scope :for_facet, -> (facet, language = nil) { where("is_#{facet}": true) } + end +end \ No newline at end of file diff --git a/app/models/university/person/with_facets.rb b/app/models/university/person/with_facets.rb index d73e7585fe..4d93b40ba4 100644 --- a/app/models/university/person/with_facets.rb +++ b/app/models/university/person/with_facets.rb @@ -15,7 +15,8 @@ module University::Person::WithFacets scope :teachers, -> { where(is_teacher: true) } scope :researchers, -> { where(is_researcher: true) } scope :alumni, -> { where(is_alumnus: true) } - scope :with_habilitation, -> { where(habilitation: true) } + + # Filters scope :for_facet, -> (facet, language = nil) { where("is_#{facet}": true) } end diff --git a/app/models/university/person/with_realm_research.rb b/app/models/university/person/with_realm_research.rb index e89ddbad31..e21390d942 100644 --- a/app/models/university/person/with_realm_research.rb +++ b/app/models/university/person/with_realm_research.rb @@ -40,6 +40,7 @@ module University::Person::WithRealmResearch through: :research_journal_papers, source: :websites + scope :with_habilitation, -> { where(habilitation: true) } scope :with_hal_identifier, -> { where.not(hal_form_identifier: [nil,'']) } end diff --git a/app/services/migrations/organizations.rb b/app/services/migrations/organizations.rb new file mode 100644 index 0000000000..0b3b288d2f --- /dev/null +++ b/app/services/migrations/organizations.rb @@ -0,0 +1,24 @@ +class Migrations::Organizations + def self.migrate + puts 'Identifying organizations to merge' + University.find_each do |university| + locations = university.locations + schools = university.schools + laboratories = university.laboratories + next if schools.none? && laboratories.none? && locations.none? + puts university + puts '--- locations' + locations.each do |location| + puts "#{location.original_localization} — #{location.id}" + end + puts '--- schools' + schools.each do |school| + puts "#{school.original_localization} — #{school.id}" + end + puts '--- laboratories' + laboratories.each do |laboratory| + puts "#{laboratory.original_localization} — #{laboratory.id}" + end + end + end +end \ No newline at end of file diff --git a/db/migrate/20260119090426_add_booleans_to_university_organization.rb b/db/migrate/20260119090426_add_booleans_to_university_organization.rb new file mode 100644 index 0000000000..0421a7f5ca --- /dev/null +++ b/db/migrate/20260119090426_add_booleans_to_university_organization.rb @@ -0,0 +1,7 @@ +class AddBooleansToUniversityOrganization < ActiveRecord::Migration[8.0] + def change + add_column :university_organizations, :is_school, :boolean, default: false + add_column :university_organizations, :is_location, :boolean, default: false + add_column :university_organizations, :is_laboratory, :boolean, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index f001e380f4..63ff855fdb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.1].define(version: 2026_06_18_144210) do +ActiveRecord::Schema[8.1].define(version: 2026_06_23_120000) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" @@ -159,6 +159,7 @@ t.string "html_class" t.jsonb "metadata" t.string "migration_identifier" + t.boolean "native", default: false t.integer "position", null: false t.boolean "published", default: true t.integer "template_kind", default: 0, null: false @@ -2299,6 +2300,9 @@ t.uuid "created_by_id" t.datetime "deleted_at" t.string "email" + t.boolean "is_laboratory", default: false + t.boolean "is_location", default: false + t.boolean "is_school", default: false t.integer "kind", default: 10 t.float "latitude" t.float "longitude"