Fixes to finding a record when FTN when region_id/host_id have the same value

This commit is contained in:
Deon George 2021-11-20 11:50:45 +11:00
parent 483e35202b
commit 6f9df005aa
3 changed files with 12 additions and 12 deletions

View File

@ -1,6 +1,6 @@
APP_NAME="Clearing Houz"
APP_NAME="Clearing Houz Testing"
APP_ENV=testing
APP_KEY=
APP_KEY=base64:FiMSvv4J7jDfy6W/sHrQ9YImuUYaxynYCcXQJwp/6Tc=
APP_DEBUG=true
#APP_URL=http://localhost
@ -8,11 +8,11 @@ LOG_CHANNEL=stderr
LOG_LEVEL=info
DB_CONNECTION=pgsql
DB_HOST=database
DB_HOST=postgres-test
DB_PORT=5432
DB_DATABASE=postgres
DB_USERNAME=postgres
DB_PASSWORD=secret
DB_PASSWORD=password
DB_MONGO_HOST=mongo
DB_MONGO_USERNAME=mongo
@ -29,8 +29,8 @@ REDIS_PASSWORD=
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mail.leenooks.vpn
MAIL_PORT=25
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=

View File

@ -19,7 +19,7 @@ use App\Traits\{ScopeActive,UsePostgres};
* + id | zone_id | region_id | host_id | node_id | point_id | status | role | system_id | hub_id
* + ----+---------+-----------+---------+---------+----------+--------+------+-----------+--------
* + 533 | 6 | 3 | 0 | 1 | 0 | | 4 | 1 |
* + 534 | 6 | 3 | 3 | 1 | 0 | | 2 | 1 |
* + 534 | 6 | n | 3 | 1 | 0 | | 2 | 1 |
* + 535 | 6 | 0 | 3 | 1 | 0 | | 2 | 1 |
*/
class Address extends Model
@ -311,13 +311,12 @@ class Address extends Model
->where(function($q) use ($ftn) {
return $q->where(function($qq) use ($ftn) {
return $qq
->where('region_id',0)
->where('host_id',$ftn['n']);
->where('region_id',$ftn['n'])
->where('host_id',0);
})
->orWhere(function($qq) use ($ftn) {
return $qq
->where('region_id',$ftn['n'])
->where('host_id',0);
->where('host_id',$ftn['n']);
});
})
->where('node_id',$ftn['f'])

View File

@ -25,6 +25,7 @@
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.3.3"
},
"config": {