Skip to content

Commit

Permalink
fix superfluous query when user is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed May 10, 2024
1 parent 7abc4ae commit 1a57eaa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/services/license_validation_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def validate!
machine_limit = license.max_machines || 1
machine_count = case
when license.lease_per_user?
owner = if scope.present?
owner = if scope.present? && scope.key?(:user)
license.users.where(id: scope[:user])
.or(
license.users.where(email: scope[:user]),
Expand Down Expand Up @@ -312,7 +312,7 @@ def validate!
machine_limit = license.max_machines
machine_count = case
when license.lease_per_user?
owner = if scope.present?
owner = if scope.present? && scope.key?(:user)
license.users.where(id: scope[:user])
.or(
license.users.where(email: scope[:user]),
Expand Down Expand Up @@ -340,7 +340,7 @@ def validate!
core_limit = license.max_cores
core_count = case
when license.lease_per_user?
owner = if scope.present?
owner = if scope.present? && scope.key?(:user)
license.users.where(id: scope[:user])
.or(
license.users.where(email: scope[:user]),
Expand Down Expand Up @@ -386,7 +386,7 @@ def validate!
process_count = license.processes.count
process_limit = license.max_processes
when license.lease_per_user?
owner = if scope.present?
owner = if scope.present? && scope.key?(:user)
license.users.where(id: scope[:user])
.or(
license.users.where(email: scope[:user]),
Expand Down

0 comments on commit 1a57eaa

Please sign in to comment.