Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 4 additions & 4 deletions app/services/connection_score_calculator.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions spec/services/connection_score_calculator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading