diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4006f4..8dd441c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,10 +20,10 @@ jobs: - name: Scan for common Rails security vulnerabilities using static analysis run: bin/brakeman --no-pager - + - name: Scan for known security vulnerabilities in gems used run: bin/bundler-audit - + lint: runs-on: ubuntu-latest env: @@ -87,4 +87,6 @@ jobs: DATABASE_URL: postgres://postgres:postgres@localhost:5432 # RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} # REDIS_URL: redis://localhost:6379/0 - run: bin/rails db:test:prepare test + run: | + bin/rails db:test:prepare + bin/rails spec diff --git a/Gemfile.lock b/Gemfile.lock index 10b6022..657f169 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -173,17 +173,17 @@ GEM net-protocol net-ssh (7.3.2) nio4r (2.7.5) - nokogiri (1.19.2-aarch64-linux-gnu) + nokogiri (1.19.3-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.19.2-aarch64-linux-musl) + nokogiri (1.19.3-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.19.2-arm-linux-gnu) + nokogiri (1.19.3-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.19.2-arm-linux-musl) + nokogiri (1.19.3-arm-linux-musl) racc (~> 1.4) - nokogiri (1.19.2-x86_64-linux-gnu) + nokogiri (1.19.3-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.19.2-x86_64-linux-musl) + nokogiri (1.19.3-x86_64-linux-musl) racc (~> 1.4) orm_adapter (0.5.0) ostruct (0.6.3) diff --git a/app/models/person.rb b/app/models/person.rb index 30f9570..0c10930 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -25,10 +25,9 @@ class Person < ApplicationRecord scope :with_upcoming_events, -> { today = Date.today - upcoming = (today...(today + UPCOMING_DAYS_WINDOW)).map { |d| [ d.month, d.day ] } - placeholders = upcoming.map { "(?, ?)" }.join(", ") + upcoming_keys = (today...(today + UPCOMING_DAYS_WINDOW)).map { |day| day.month * 100 + day.day } joins(:important_dates) - .where("(important_dates.month, important_dates.day) IN (#{placeholders})", *upcoming.flatten) + .where("important_dates.month * 100 + important_dates.day IN (?)", upcoming_keys) .distinct } diff --git a/app/services/connection_score_calculator.rb b/app/services/connection_score_calculator.rb index b8f1396..914a3f4 100644 --- a/app/services/connection_score_calculator.rb +++ b/app/services/connection_score_calculator.rb @@ -1,10 +1,10 @@ class ConnectionScoreCalculator RING_SCORE = { - "inner_circle" => 4, - "network" => 3, - "community" => 2, + "inner_circle" => 4, + "network" => 3, + "community" => 2, "acquaintances" => 1, - "stranger" => 1 + "stranger" => 1 }.freeze TWO_WEEKS = 14 diff --git a/spec/services/connection_score_calculator_spec.rb b/spec/services/connection_score_calculator_spec.rb index 1d3f51a..277492f 100644 --- a/spec/services/connection_score_calculator_spec.rb +++ b/spec/services/connection_score_calculator_spec.rb @@ -3,11 +3,11 @@ RSpec.describe ConnectionScoreCalculator do def baseline_person(**overrides) create(:person, - ring: :stranger, - score_source: :manual, - importance_score: 1, - reciprocity_score: 1, - shared_values_score: 1, + ring: :stranger, + score_source: :manual, + importance_score: 1, + reciprocity_score: 1, + shared_values_score: 1, **overrides ) end