/*
- * Copyright © 2020 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
protected String doInBackground(MainModel[] model) {
final MobileLedgerProfile profile = Data.getProfile();
- String profile_uuid = profile.getUuid();
+ long profile_id = profile.getId();
Data.backgroundTaskStarted();
try {
String sql;
final String accFilter = model[0].getAccountFilter()
.getValue();
if (accFilter == null) {
- sql = "SELECT id, year, month, day FROM transactions WHERE profile=? ORDER BY " +
+ sql = "SELECT id, year, month, day FROM transactions WHERE profile_id=? ORDER BY " +
"year desc, month desc, day desc, id desc";
- params = new String[]{profile_uuid};
+ params = new String[]{String.valueOf(profile_id)};
}
else {
sql = "SELECT distinct tr.id, tr.year, tr.month, tr.day from transactions tr " +
- "JOIN " + "transaction_accounts ta " +
- "ON ta.transaction_id=tr.id AND ta.profile=tr.profile WHERE tr.profile=? " +
- "and ta.account_name LIKE ?||'%' AND ta" +
- ".amount <> 0 ORDER BY tr.year desc, tr.month desc, tr.day desc, tr.id " +
- "desc";
- params = new String[]{profile_uuid, accFilter};
+ "JOIN transaction_accounts ta ON ta.transaction_id=tr.id WHERE tr" +
+ ".profile_id=? and ta.account_name LIKE ?||'%' AND ta.amount <> 0 ORDER " +
+ "BY tr.year desc, tr.month desc, tr.day desc, tr.id " + "desc";
+ params = new String[]{String.valueOf(profile_id), accFilter};
}
debug("UTT", sql);