Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mayswind committed Jul 3, 2024
1 parent b800414 commit 7a5d733
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/services/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,11 @@ func (s *TransactionService) getTransactionQueryCondition(uid int64, maxTransact
conditionParams = append(conditionParams, categoryIds[i])
}

condition = condition + " AND category_id IN (" + conditions.String() + ")"
if conditions.Len() > 1 {
condition = condition + " AND category_id IN (" + conditions.String() + ")"
} else {
condition = condition + " AND category_id = " + conditions.String()
}
}

if len(accountIds) > 0 {
Expand All @@ -1396,7 +1400,11 @@ func (s *TransactionService) getTransactionQueryCondition(uid int64, maxTransact
conditionParams = append(conditionParams, accountIds[i])
}

condition = condition + " AND account_id IN (" + conditions.String() + ")"
if conditions.Len() > 1 {
condition = condition + " AND account_id IN (" + conditions.String() + ")"
} else {
condition = condition + " AND account_id = " + conditions.String()
}
}

if amountFilter != "" {
Expand Down

0 comments on commit 7a5d733

Please sign in to comment.