Skip to content

Commit

Permalink
Don't sync and brag disabled clubs.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Dec 1, 2024
1 parent ef8c24b commit b3f3d70
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-11-29 15:39:05 UTC using RuboCop version 1.68.0.
# on 2024-12-01 16:21:41 UTC using RuboCop version 1.68.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -82,7 +82,7 @@ Naming/VariableNumber:
RSpec/AnyInstance:
Enabled: false

# Offense count: 193
# Offense count: 194
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand Down Expand Up @@ -151,7 +151,7 @@ RSpec/InstanceVariable:
- 'spec/slack-strava/service_spec.rb'
- 'spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb'

# Offense count: 36
# Offense count: 39
RSpec/LetSetup:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion slack-strava/models/club.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Club

has_many :activities, class_name: 'ClubActivity', dependent: :destroy

scope :connected_to_strava, -> { where(:access_token.ne => nil) }
scope :connected_to_strava, -> { where(:access_token.ne => nil, sync_activities: true) }

def to_s
"strava_id=#{strava_id}, name=#{name}, url=#{strava_url}, channel_id=#{channel_id}, channel_name=#{channel_name}, #{team}"
Expand Down
10 changes: 10 additions & 0 deletions spec/models/club_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,15 @@
end

pending 'uses a lock'

context 'connected_to_strava' do
let!(:club) { Fabricate(:club) }
let!(:club_not_connected_to_strava) { Fabricate(:club, access_token: nil) }
let!(:club_sync_activities_false) { Fabricate(:club, access_token: 'token', sync_activities: false) }

it 'includes only clubs connected to strava with sync_activities' do
expect(described_class.connected_to_strava.count).to eq 1
end
end
end
end

0 comments on commit b3f3d70

Please sign in to comment.