Skip to content

Commit

Permalink
save commit
Browse files Browse the repository at this point in the history
  • Loading branch information
praslnx8 committed Jan 26, 2024
1 parent 541c515 commit de513d0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
17 changes: 7 additions & 10 deletions lib/api/db/app_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,11 @@ abstract class InvestmentEnrichedView extends View {

Expression<String> get basketName => basket.name;

Expression<double> get totalInvestedAmount => transaction.amount.sum();
Expression<int> get totalTransactions => transaction.id.count(distinct: true, filter: transaction.investmentId.equalsExp(investment.id));

Expression<int> get totalTransactions => transaction.id.count();
Expression<int> get totalSips => sip.id.count(distinct: true, filter: sip.investmentId.equalsExp(investment.id));

Expression<int> get totalSips => sip.id.count();

Expression<int> get taggedGoals => goalInvestment.id.count();
Expression<int> get taggedGoals => goalInvestment.id.count(distinct: true, filter: goalInvestment.investmentId.equalsExp(investment.id));

@override
Query as() => select([
Expand All @@ -146,7 +144,6 @@ abstract class InvestmentEnrichedView extends View {
investment.valueUpdatedOn,
basketId,
basketName,
totalInvestedAmount,
totalTransactions,
totalSips,
taggedGoals
Expand Down Expand Up @@ -201,7 +198,7 @@ abstract class SipEnrichedView extends View {

Expression<String> get investmentName => investment.name;

Expression<int> get transactionCount => transaction.id.count();
Expression<int> get transactionCount => transaction.id.count(distinct: true, filter: transaction.sipId.equalsExp(sip.id));

@override
Query as() => select([
Expand Down Expand Up @@ -230,9 +227,9 @@ abstract class BasketEnrichedView extends View {

TransactionTable get transaction;

Expression<int> get totalInvestmentCount => investment.id.count();
Expression<int> get totalInvestmentCount => investment.id.count(distinct: true, filter: investment.basketId.equalsExp(basket.id));

Expression<double> get investedAmount => transaction.amount.sum();
Expression<double> get investedAmount => transaction.amount.sum(filter: transaction.investmentId.equalsExp(investment.id));

@override
Query as() => select([
Expand Down Expand Up @@ -283,7 +280,7 @@ abstract class GoalEnrichedView extends View {

GoalInvestmentTable get goalInvestment;

Expression<int> get taggedInvestmentCount => goalInvestment.id.count();
Expression<int> get taggedInvestmentCount => goalInvestment.id.count(distinct: true, filter: goalInvestment.goalId.equalsExp(goal.id));

@override
Query as() => select([
Expand Down
53 changes: 28 additions & 25 deletions lib/api/db/app_database.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit de513d0

Please sign in to comment.