Browse Source

debug stuff

debug
forest 6 months ago
parent
commit
1beba6de8b
  1. 11
      client/accountsAndCategoriesController.js
  2. 4
      client/importController.js
  3. 2
      client/index.js
  4. 15
      client/reportsController.js
  5. 18
      client/transactionDataService.js
  6. 2
      settings.js

11
client/accountsAndCategoriesController.js

@ -114,6 +114,8 @@ const accountsAndCategoriesController = new (function AccountsAndCategoriesContr
const repaintIndex = (allTransactions, accounts, categories) => {
console.log("REPAINT!!!6 repaintIndex");
const transactionsByAccount = allTransactions.reduce((accum, tx) => {
if(!accum[tx.account]) {
accum[tx.account] = [];
@ -269,6 +271,8 @@ const accountsAndCategoriesController = new (function AccountsAndCategoriesContr
const repaintCategories = () => {
console.log("REPAINT!!! 10 repaintCategories")
if(durationSelect.value != selectedCategoryAggregationDurationId) {
selectedCategoryAggregationDurationId = durationSelect.value;
@ -309,6 +313,8 @@ const accountsAndCategoriesController = new (function AccountsAndCategoriesContr
};
const repaintDrilldown = (transactions, thing) => {
console.log("REPAINT!!!5 repaintDrilldown");
const container = document.getElementById('accounts-drilldown');
while (container.hasChildNodes()) {
container.removeChild(container.lastChild);
@ -382,6 +388,11 @@ const accountsAndCategoriesController = new (function AccountsAndCategoriesContr
};
this.repaint = () => {
if(document.getElementById('accounts-content').style.display == 'none') {
console.log("skip accounts and categories repaint");
return
}
console.log("REPAINT!!!1");
transactionDataService.getAllTransactions().then(allTransactions => {
document.getElementById('accounts-content').classList.toggle('drilldown', drilldownAccountOrCategoryId != null);

4
client/importController.js

@ -1122,6 +1122,8 @@ this.processFilesWithAccountsAlreadyLoaded = (files) => {
this.loadAccountsAndRepaintImportedFiles = () => {
console.log("REPAINT!!!3 loadAccountsAndRepaintImportedFiles");
const importedFilesDiv = document.getElementById('imported-files-area');
while (importedFilesDiv.hasChildNodes()) {
importedFilesDiv.removeChild(importedFilesDiv.lastChild);
@ -1278,6 +1280,8 @@ const importTransactions = (parentDiv, file) => {
};
const repaintCategorizationInput = (initialCategory) => {
console.log("REPAINT!!!1 repaintCategorizationInput");
const categorizationOptionsArea = document.getElementById('categorize-options-area');
while (categorizationOptionsArea.hasChildNodes()) {
categorizationOptionsArea.removeChild(categorizationOptionsArea.lastChild);

2
client/index.js

@ -295,6 +295,7 @@ function TransactionList(parentDiv, context, columns, transactions) {
table.append(body);
this.repaintTransactions = () => {
console.log("REPAINT!! 8 repaintTransactions")
while(body.hasChildNodes()) {
body.removeChild(body.lastChild);
}
@ -339,6 +340,7 @@ function TransactionList(parentDiv, context, columns, transactions) {
}
function repaintThingCardList(params) {
console.log("REPAINT!!! 9 repaintThingCardList")
const {container, things, buildButtons, buildContent, setupNewButton} = params;
while (container.hasChildNodes()) {
container.removeChild(container.lastChild);

15
client/reportsController.js

@ -1089,6 +1089,8 @@ reportsController = new (function ReportsController() {
const repaintReportChart = (params) => {
console.log("REPAINT!!! 14 repaintReportChart");
const {getContainer, things, reports, report, options} = params;
const aggregations = things.filter(x => x.type == 'aggregation').reduce((accum, x) => {
accum[x.id] = x;
@ -1114,6 +1116,7 @@ reportsController = new (function ReportsController() {
};
const repaintReportWithControls = (params) => {
console.log("REAPINT !!! 15 repaintReportWithControls ")
const {container, id, report, onchange} = params;
while (container.hasChildNodes()) {
container.removeChild(container.lastChild);
@ -1361,6 +1364,8 @@ reportsController = new (function ReportsController() {
};
const repaintFormInputs = () => {
console.log("REAPINT !!! 16 repaintFormInputs ")
const reportThingsRow = document.getElementById('report-things-row');
const selectedType = typeInputs.filter(x => x.checked).map(x => x.value)[0];
let reportToUse = report;
@ -1432,6 +1437,8 @@ reportsController = new (function ReportsController() {
nameField.onkeyup = validate;
repaintPreviewChart = () => {
console.log("REAPINT !!! 17 repaintPreviewChart ")
const chartContainer = document.getElementById('report-preview-container');
const reportFromDOM = {
id: report.id
@ -1455,6 +1462,8 @@ reportsController = new (function ReportsController() {
};
repaintPreview = () => {
console.log("REAPINT !!! 18 repaintPreview ")
let reportToUse = report;
if(previewContainer.hasChildNodes()) {
reportToUse = {};
@ -1649,6 +1658,8 @@ reportsController = new (function ReportsController() {
}
const repaintThisChart = () => {
console.log("REPAINT!!! 11 repaintThisChart");
fillOutReportTimeSettings(report, id);
db.put(keyReports(report.id), report).then(_ => {
repaintReportChart({
@ -1671,6 +1682,8 @@ reportsController = new (function ReportsController() {
};
this.repaint = () => {
console.log("REPAINT!!! 12 repaint reports");
document.getElementById('reports-content').classList.toggle('drilldown', drilldownReportId != null);
document.getElementById('reports-index').style.display = drilldownReportId == null ? 'block' : 'none';
document.getElementById('reports-drilldown').style.display = drilldownReportId == null ? 'none' : 'block';
@ -1742,6 +1755,7 @@ reportsController = new (function ReportsController() {
const repaintAggregationsList = () => {
console.log("REPAINT!!! 13 repaint repaintAggregationsList");
const container = document.getElementById('aggregations-list-container');
const accounts = transactionDataService.getAccounts();
const categories = transactionDataService.getCategories();
@ -1835,6 +1849,7 @@ reportsController = new (function ReportsController() {
};
const repaintReportsList = () => {
console.log("REPAINT!!! 13 repaintReportsList");
const container = document.getElementById('reports-list-container');
const accounts = transactionDataService.getAccounts();
const categories = transactionDataService.getCategories();

18
client/transactionDataService.js

@ -49,6 +49,7 @@ const transactionDataService = new (function TransactionDataService() {
};
const getTransactionsByIdResults = (idResults) => {
console.log("getTransactionsByIdResults")
const idsSet = {};
const range = idResults.reduce((accum, keyValue) => {
const id = keyValue.value;
@ -66,6 +67,7 @@ const transactionDataService = new (function TransactionDataService() {
};
const getSearchIndexForTransactions = (txs) => {
console.log("getSearchIndexFor "+txs.length+" Transactions")
const tokensSet = txs.map(searchTokenize)
.reduce((accum, tokens) => {
tokens.forEach(token => accum[token] = true);
@ -85,6 +87,7 @@ const transactionDataService = new (function TransactionDataService() {
));
} else {
getAlreadyExistingTokenRecords = db.keyPrefix(keyPrefixTxCategorySearchIndex).then(keyValues => {
console.log("getAlreadyExistingTokenRecords")
const toReturn = [];
let j = 0;
let i = 0;
@ -114,6 +117,7 @@ const transactionDataService = new (function TransactionDataService() {
}
const transactionWithViewPropertiesRemoved = (tx) => {
console.log("transactionWithViewPropertiesRemoved")
const toReturn = {};
Object.entries(tx).forEach(tuple => {
if(tuple[0].indexOf('view') != 0) {
@ -124,6 +128,7 @@ const transactionDataService = new (function TransactionDataService() {
}
const putTransactionsDirect = (txns, writeTransactionsById) => {
console.log("putTransactionsDirect")
return getSearchIndexForTransactions(txns).then(searchIndex => {
txns.forEach(
tx => searchTokenize(tx).forEach(token => {
@ -157,6 +162,7 @@ const transactionDataService = new (function TransactionDataService() {
};
this.ingestTransactions = (txns) => {
console.log("ingestTransactions")
if(!Array.isArray(txns)) {
txns = [txns];
}
@ -193,6 +199,7 @@ const transactionDataService = new (function TransactionDataService() {
};
this.recreateSecondaryIndexes = () => {
console.log("recreateSecondaryIndexes")
return db.range({
gte: keyPrefixTxById,
lte: keyPrefixTxById+'\xff'
@ -202,6 +209,7 @@ const transactionDataService = new (function TransactionDataService() {
};
this.modifyTransactions = (txs) => {
console.log("modifyTransactions")
if(!Array.isArray(txs)) {
txs = [txs];
}
@ -268,6 +276,7 @@ const transactionDataService = new (function TransactionDataService() {
};
this.deleteTransactions = (txs, removeFromSearch) => {
console.log("deleteTransactions")
if(!Array.isArray(txs)) {
txs = [txs];
}
@ -304,6 +313,7 @@ const transactionDataService = new (function TransactionDataService() {
};
this.suggestToSlashFromForTransaction = (tx, categoriesAndAccounts) => {
console.log("suggestToSlashFromForTransaction")
//debugger;
const tokens = searchTokenize(tx);
const popularities = {};
@ -343,6 +353,7 @@ const transactionDataService = new (function TransactionDataService() {
}
this.getTransactionsByDateRange = (minMillisecondsSinceEpoch, maxMillisecondsSinceEpoch) => {
console.log("getTransactionsByDateRange")
return db.range({
gte: keyTxIdByDate(minMillisecondsSinceEpoch, 0),
lte: keyTxIdByDate(maxMillisecondsSinceEpoch, 0)
@ -350,10 +361,12 @@ const transactionDataService = new (function TransactionDataService() {
};
this.getTransactionsByAccountOrCategoryId = (accountOrCategoryId) => {
console.log("getTransactionsByAccountOrCategoryId " + accountOrCategoryId)
return db.keyPrefix(keyTxIdByAccountOrCategory(accountOrCategoryId)).then(getTransactionsByIdResults);
};
this.getAllTransactions = () => {
console.log("getAllTransactions ")
return db.keyPrefix(keyPrefixTxById);
};
@ -376,7 +389,9 @@ const transactionDataService = new (function TransactionDataService() {
};
this.init = () => {
console.log("tds init ")
db.subscribeToOpen(() => {
console.log("tds init subscribeToOpen")
return Promise.all([
db.keyPrefix(keyPrefixAccounts),
db.keyPrefix(keyPrefixCategories),
@ -384,6 +399,7 @@ const transactionDataService = new (function TransactionDataService() {
db.get(keyMeta('randomColorId')).then(x => x, x => 0),
db.get(keyMeta('accountOrCategoryId')).then(x => x, x => 0)
]).then(results => {
console.log("tds init subscribeToOpen 2")
if(results[0].length) {
navController.navigate('accounts');
@ -410,6 +426,7 @@ const transactionDataService = new (function TransactionDataService() {
db.keyPrefix(keyPrefixTxIdByDate),
db.keyPrefix(keyPrefixTxById),
]).then(results => {
console.log("tds init subscribeToOpen 3")
const constraintViolations = [];
const accountByTxId = {};
const toSlashFromByTxId = {};
@ -494,6 +511,7 @@ const transactionDataService = new (function TransactionDataService() {
});
});
const onPutDelete = (operation, key, value) => {
console.log("tds onPutDelete")
if(operation == 'put') {
accountsAndCategories[value.id] = value;
} else if(operation == 'del') {

2
settings.js

@ -1,6 +1,6 @@
module.exports = {
isProduction: true,
isProduction: false,
autoSaveDebounceDurationMs: 5000,
keyPrefixMeta: '01:',
keyPrefixAccounts: '02:',

Loading…
Cancel
Save