Skip to content

Commit

Permalink
fix only_internal users
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiomagalhaes committed Dec 5, 2024
1 parent 60bd4c9 commit 6e4fff0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
26 changes: 12 additions & 14 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-07-01 18:59:17 UTC using RuboCop version 1.56.2.
# on 2024-12-05 19:15:44 UTC using RuboCop version 1.56.2.
# 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 All @@ -12,27 +12,26 @@ Lint/MissingSuper:
Exclude:
- 'app/services/time_off_builder.rb'

# Offense count: 10
# Offense count: 11
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 34

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 27

# Offense count: 1
# Offense count: 2
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 8
Max: 9

# Offense count: 16
# Offense count: 18
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 23

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 10

# Offense count: 1
# Configuration parameters: Include.
# Include: app/controllers/**/*.rb, app/mailers/**/*.rb
Expand All @@ -53,17 +52,16 @@ Security/Eval:
Exclude:
- 'app/models/dynamic_dataset.rb'

# Offense count: 5
# Offense count: 4
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'app/models/concerns/calculable.rb'
- 'app/models/maintenance_contract_model.rb'
- 'app/models/retainer_contract_model.rb'
- 'app/utils/analytics/finances/models/financial_statements_of_work.rb'

# Offense count: 12
# Offense count: 14
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ GEM
nio4r (2.5.9)
nokogiri (1.15.4-aarch64-linux)
racc (~> 1.4)
nokogiri (1.15.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
parallel (1.23.0)
Expand Down Expand Up @@ -319,6 +321,7 @@ GEM

PLATFORMS
aarch64-linux
arm64-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/analytics/skills_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def index
private

def search_skills
return Skill.all unless params[:search].present?
return Skill.all if params[:search].blank?

Skill.where('name ILIKE ?', "%#{params[:search]}%")
end
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class UsersController < ApplicationController
def index
query = params['query']&.split(',')
skills_filter = params['filter_by_skills']&.split(/[\s,]+/)&.map(&:downcase)
only_internal = params['only_internal']

@users = if query
User.by_external_identifier(query)
Expand All @@ -16,6 +17,8 @@ def index
if skills_filter.present?
@users = @users.joins(:skills).where('LOWER(skills.name) LIKE ANY (ARRAY[?])', skills_filter.map { |s| "%#{s}%" })
end

@users = @users.where(internal: true) if only_internal.present?
@users = @users.order(:first_name, :last_name)
end

Expand Down

0 comments on commit 6e4fff0

Please sign in to comment.