Skip to content

Commit

Permalink
fix: only generate condition if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Jun 4, 2024
1 parent 01f6503 commit cae3b31
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/DIRAC/AccountingSystem/DB/AccountingDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,8 @@ def __queryType(
sqlORList.append(f"`{_getTableName('key', typeName, keyName)}`.`value` = {keyValue}")
else:
sqlORList.append(f"`{tableName}`.`{keyName}` = {keyValue}")
sqlCondList.append(f"( {' OR '.join(sqlORList)} )")
if sqlORList:
sqlCondList.append(f"( {' OR '.join(sqlORList)} )")
if sqlCondList:
cmd += f" AND {' AND '.join(sqlCondList)}"
# Calculate grouping and sorting
Expand Down

0 comments on commit cae3b31

Please sign in to comment.