mirror of
https://github.com/IT4Change/gradido.git
synced 2026-04-06 01:25:28 +00:00
fix lint
This commit is contained in:
parent
b94d6ae89a
commit
94436bfc54
@ -21,11 +21,7 @@ export class Context {
|
||||
public cache: KeyPairCacheManager
|
||||
private timeUsed: Profiler
|
||||
|
||||
constructor(
|
||||
logger: Logger,
|
||||
db: MySql2Database,
|
||||
cache: KeyPairCacheManager
|
||||
) {
|
||||
constructor(logger: Logger, db: MySql2Database, cache: KeyPairCacheManager) {
|
||||
this.logger = logger
|
||||
this.db = db
|
||||
this.cache = cache
|
||||
|
||||
@ -54,10 +54,8 @@ export async function loadCommunities(db: MySql2Database): Promise<CommunityDb[]
|
||||
.from(communitiesTable)
|
||||
.innerJoin(usersTable, eq(communitiesTable.communityUuid, usersTable.communityUuid))
|
||||
.where(
|
||||
and(
|
||||
isNotNull(communitiesTable.communityUuid),
|
||||
sql`${usersTable.createdAt} > '2000-01-01'`),
|
||||
)
|
||||
and(isNotNull(communitiesTable.communityUuid), sql`${usersTable.createdAt} > '2000-01-01'`),
|
||||
)
|
||||
.orderBy(asc(communitiesTable.id))
|
||||
.groupBy(communitiesTable.communityUuid)
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ export class RemoteTransactionsSyncRole extends AbstractSyncRole<TransactionDb>
|
||||
publicKey: MemoryBlockPtr,
|
||||
): AccountBalances {
|
||||
this.accountBalances.clear()
|
||||
|
||||
|
||||
// try to use same coins from this community
|
||||
let lastBalance = this.getLastBalanceForUser(
|
||||
publicKey,
|
||||
@ -133,11 +133,10 @@ export class RemoteTransactionsSyncRole extends AbstractSyncRole<TransactionDb>
|
||||
coinCommunityId,
|
||||
)
|
||||
if (
|
||||
coinCommunityId != communityContext.communityId &&
|
||||
(
|
||||
lastBalance.getBalance().equal(GradidoUnit.zero()) ||
|
||||
coinCommunityId !== communityContext.communityId &&
|
||||
(lastBalance.getBalance().equal(GradidoUnit.zero()) ||
|
||||
lastBalance.getBalance().calculateDecay(lastBalance.getDate(), item.balanceDate).lt(amount))
|
||||
) {
|
||||
) {
|
||||
// don't work, so we use or own coins
|
||||
lastBalance = this.getLastBalanceForUser(
|
||||
publicKey,
|
||||
@ -146,8 +145,12 @@ export class RemoteTransactionsSyncRole extends AbstractSyncRole<TransactionDb>
|
||||
)
|
||||
}
|
||||
if (
|
||||
lastBalance.getBalance().calculateDecay(lastBalance.getDate(), item.balanceDate).add(amount).lt(GradidoUnit.zero())
|
||||
&& communityContext.foreign
|
||||
lastBalance
|
||||
.getBalance()
|
||||
.calculateDecay(lastBalance.getDate(), item.balanceDate)
|
||||
.add(amount)
|
||||
.lt(GradidoUnit.zero()) &&
|
||||
communityContext.foreign
|
||||
) {
|
||||
this.accountBalances.add(new AccountBalance(publicKey, GradidoUnit.zero(), coinCommunityId))
|
||||
return this.accountBalances
|
||||
@ -156,7 +159,7 @@ export class RemoteTransactionsSyncRole extends AbstractSyncRole<TransactionDb>
|
||||
try {
|
||||
lastBalance.updateLegacyDecay(amount, item.balanceDate)
|
||||
} catch (e) {
|
||||
if (e instanceof NegativeBalanceError) {
|
||||
if (e instanceof NegativeBalanceError) {
|
||||
this.logLastBalanceChangingTransactions(publicKey, communityContext.blockchain, 1)
|
||||
throw e
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ export class UsersSyncRole extends AbstractSyncRole<UserDb> {
|
||||
gt(usersTable.id, lastIndex.id),
|
||||
),
|
||||
),
|
||||
isNotNull(usersTable.communityUuid)
|
||||
isNotNull(usersTable.communityUuid),
|
||||
),
|
||||
)
|
||||
.orderBy(asc(usersTable.createdAt), asc(usersTable.id))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user