Fixing the usage of ternary operator in model which caused Empty Query error.
Merge pull request #1448 from Martynas-P/v1.5.6.x

Fixing the usage of ternary operator in model which caused Empty Query error