Versie 0.2.0
This commit is contained in:
commit
e77d8fd373
495 files changed
+81026
No files matched your search
@@ -0,0 +1,27 @@
|
||||
// Generated, do not edit. sha256:37f1d463b03d2b5d702238cb632740786fc53e2072e4691719327d700c59d56c
|
||||
import { capacityReached } from '../license.mjs';
|
||||
import * as db from '../db.js';
|
||||
import { counts } from './counts.js';
|
||||
import { RATE_ONLY_ASSET } from './_shared.js';
|
||||
import { getBaseCurrency } from './portfolio.js';
|
||||
|
||||
function fiatAccountCount() {
|
||||
return db.one(`SELECT COUNT(*) AS n FROM Account WHERE kind = 'bank'`).n;
|
||||
}
|
||||
|
||||
function assetCount() {
|
||||
return db.one(`SELECT COUNT(*) AS n FROM Asset WHERE symbol <> ? AND NOT ${RATE_ONLY_ASSET}`,
|
||||
[getBaseCurrency()]).n;
|
||||
}
|
||||
|
||||
export function currentCount(soort) {
|
||||
const c = counts();
|
||||
if (soort === 'assets') return assetCount();
|
||||
if (soort === 'valuations') return c.valuations;
|
||||
if (soort === 'fiatAccounts') return fiatAccountCount();
|
||||
throw new Error(`No counter for capacity '${soort}' yet.`);
|
||||
}
|
||||
|
||||
export function capacityReachedFor(soort) {
|
||||
return capacityReached(soort, currentCount(soort));
|
||||
}
|
||||
Reference in new issue
Block a user