Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
d297eb60b3
|
|||
5744e84842
|
|||
b8083ec41e
|
|||
f559aba317
|
|||
97dfcbe2fb
|
@ -36,10 +36,9 @@ def get_account_saldo(user, token_info, accountId=None):
|
|||||||
def get_tenant_with_saldo(user, token_info):
|
def get_tenant_with_saldo(user, token_info):
|
||||||
return dbGetMany(user, token_info, {
|
return dbGetMany(user, token_info, {
|
||||||
"statement": """
|
"statement": """
|
||||||
SELECT t.firstname, t.lastname, t.address1, sum(a.amount) AS saldo
|
SELECT t.id, t.firstname, t.lastname, t.address1, sum(a.amount) AS saldo
|
||||||
FROM tenant_t t, account_entry_t a
|
FROM tenant_t t LEFT OUTER JOIN account_entry_t a ON a.account = t.account
|
||||||
WHERE a.account = t.account
|
GROUP BY t.id, t.firstname, t.lastname, t.address1
|
||||||
GROUP BY t.firstname, t.lastname, t.address1
|
|
||||||
""",
|
""",
|
||||||
"params": ()
|
"params": ()
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
from db import dbGetMany, dbGetOne
|
from db import dbGetMany, dbGetOne
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
import datetime
|
||||||
|
|
||||||
def perform(dbh, params):
|
def perform(dbh, params):
|
||||||
createdAt = params['created_at']
|
try:
|
||||||
|
createdAt = params['created_at']
|
||||||
|
except KeyError:
|
||||||
|
createdAt = datetime.datetime.today().strftime("%Y-%m-%d")
|
||||||
|
|
||||||
tenants = dbGetMany(dbh, { "statement": "SELECT * FROM tenant_t", "params": () })
|
tenants = dbGetMany(dbh, { "statement": "SELECT * FROM tenant_t", "params": () })
|
||||||
for tenant in tenants:
|
for tenant in tenants:
|
||||||
|
@ -38,14 +38,21 @@ parser.add_argument('--verbosity', '-v',
|
|||||||
help='Minimal log level for output: DEBUG, INFO, WARNING, ..., default: DEBUG',
|
help='Minimal log level for output: DEBUG, INFO, WARNING, ..., default: DEBUG',
|
||||||
required=False,
|
required=False,
|
||||||
default="DEBUG")
|
default="DEBUG")
|
||||||
|
parser.add_argument('--nocolorize', '-n',
|
||||||
|
help='disable colored output (for cron)',
|
||||||
|
required=False,
|
||||||
|
action='store_true',
|
||||||
|
default=False)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
operation = args.operation
|
operation = args.operation
|
||||||
params = json.loads(args.params)
|
params = json.loads(args.params)
|
||||||
logLevel = args.verbosity
|
logLevel = args.verbosity
|
||||||
|
noColorize = args.nocolorize
|
||||||
|
|
||||||
|
|
||||||
logger.remove()
|
logger.remove()
|
||||||
logger.add(sys.stderr, colorize=True, level=logLevel)
|
logger.add(sys.stderr, colorize=(not noColorize), level=logLevel)
|
||||||
|
|
||||||
|
|
||||||
dbh = None
|
dbh = None
|
||||||
|
@ -90,11 +90,18 @@ export class TenantDetailsComponent implements OnInit {
|
|||||||
async getTenant(): Promise<void> {
|
async getTenant(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const id = +this.route.snapshot.paramMap.get('id')
|
const id = +this.route.snapshot.paramMap.get('id')
|
||||||
|
this.messageService.add(`getTenant, id=${id}`)
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
|
this.messageService.add("getTenant, not-0-branch")
|
||||||
this.tenantId = id
|
this.tenantId = id
|
||||||
this.tenant = await this.tenantService.getTenant(id)
|
this.tenant = await this.tenantService.getTenant(id)
|
||||||
this.account = await this.accountService.getAccount(this.tenant.account)
|
this.account = await this.accountService.getAccount(this.tenant.account)
|
||||||
this.getTenancies()
|
this.getTenancies()
|
||||||
|
} else {
|
||||||
|
this.messageService.add("getTenant, 0-branch")
|
||||||
|
this.tenant = NULL_Tenant
|
||||||
|
this.account = NULL_Account
|
||||||
|
this.tenancies = []
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||||
|
Reference in New Issue
Block a user