Skip to content

Commit

Permalink
Merge pull request #74 from hitobito/psql-migration
Browse files Browse the repository at this point in the history
psql-migration
  • Loading branch information
Vakmeth authored Aug 30, 2024
2 parents 011d3c9 + 6b1827e commit 803778d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
default: 'master'
jobs:
wagon_tests:
uses: hitobito/hitobito/.github/workflows/wagon-tests.yml@master
uses: hitobito/hitobito/.github/workflows/wagon-tests.yml@psql-migration
with:
wagon_repository: ${{ github.event.repository.name }}
core_ref: ${{ inputs.core_ref }}
Expand Down
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ load 'rspec/rails/tasks/rspec.rake'
require 'ci/reporter/rake/rspec' unless Rails.env.production?

HitobitoYouth::Wagon.load_tasks

task 'test:prepare' => 'db:test:prepare'
2 changes: 1 addition & 1 deletion app/controllers/youth/event/lists_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def courses_for_bsv_export
course_filters
.to_scope
.includes(participations: [:roles, person: :location])
.order("event_dates.start_at")
.order("start_at")
end

def dates_from_to
Expand Down
10 changes: 0 additions & 10 deletions app/indices/person_index.rb

This file was deleted.

8 changes: 6 additions & 2 deletions app/models/youth/event/course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ def tentatives_count
def organizers
Person
.includes(:roles)
.where(roles: {type: organizing_role_types,
group_id: groups.collect(&:id)})
.where(
roles: {
type: organizing_role_types.map(&:to_s),
group_id: groups.collect(&:id)
}
)
end

def default_participation_state(participation, for_someone_else = false)
Expand Down
3 changes: 3 additions & 0 deletions app/models/youth/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ module Youth::Person
NATIONALITIES_J_S = %w[CH FL ANDERE].freeze

included do
Person::SEARCHABLE_ATTRS << :ahv_number << :j_s_number
include PgSearchable

has_many :people_managers, foreign_key: :managed_id,
dependent: :destroy
has_many :people_manageds, class_name: "PeopleManager",
Expand Down
27 changes: 27 additions & 0 deletions spec/domain/search_strategies/person_search_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require "spec_helper"

describe SearchStrategies::PersonSearch do
before do
people(:bottom_leader).update!(j_s_number: 12345, ahv_number: "756.9217.0769.85")
end

describe "#search_fulltext" do
let(:user) { people(:top_leader) }

it "finds accessible person by j_s number" do
result = search_class(people(:bottom_leader).j_s_number.to_s).search_fulltext

expect(result).to include(people(:bottom_leader))
end

it "finds accessible person by ahv number" do
result = search_class(people(:bottom_leader).ahv_number.to_s).search_fulltext

expect(result).to include(people(:bottom_leader))
end
end

def search_class(term = nil, page = nil)
described_class.new(user, term, page)
end
end

0 comments on commit 803778d

Please sign in to comment.