Merge branch 'master' into refactor_arithmetic_merge

This commit is contained in:
Alexander Friedland 2022-03-07 16:38:37 +01:00 committed by GitHub
commit 187deba1a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 53 deletions

View File

@ -9,41 +9,25 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
transactionList: {
transactions: [
{
type: 'creation',
balance: 100,
decayStart: 0,
decayEnd: 0,
decayDuration: 0,
id: 1,
amount: 100,
balanceDate: 0,
creationDate: new Date(),
memo: 'Testing',
transactionId: 1,
name: 'Gradido Akademie',
email: 'bibi@bloxberg.de',
date: new Date(),
decay: {
balance: 0.01,
decayStart: 0,
decayEnd: 0,
decayDuration: 0,
decayStartBlock: 0,
linkedUser: {
firstName: 'Gradido',
lastName: 'Akademie',
},
},
{
type: 'creation',
balance: 200,
decayStart: 0,
decayEnd: 0,
decayDuration: 0,
id: 2,
amount: 200,
balanceDate: 0,
creationDate: new Date(),
memo: 'Testing 2',
transactionId: 2,
name: 'Gradido Akademie',
email: 'bibi@bloxberg.de',
date: new Date(),
decay: {
balance: 0.01,
decayStart: 0,
decayEnd: 0,
decayDuration: 0,
decayStartBlock: 0,
linkedUser: {
firstName: 'Gradido',
lastName: 'Akademie',
},
},
],

View File

@ -15,30 +15,32 @@ export default {
return {
fields: [
{
key: 'date',
key: 'creationDate',
label: this.$t('transactionlist.date'),
formatter: (value, key, item) => {
return this.$d(new Date(value))
},
},
{
key: 'balance',
key: 'amount',
label: this.$t('transactionlist.amount'),
formatter: (value, key, item) => {
return `${value} GDD`
},
},
{ key: 'name', label: this.$t('transactionlist.community') },
{
key: 'linkedUser',
label: this.$t('transactionlist.community'),
formatter: (value, key, item) => {
return `${value.firstName} ${value.lastName}`
},
},
{ key: 'memo', label: this.$t('transactionlist.memo') },
{
key: 'decay',
label: this.$t('transactionlist.decay'),
key: 'balanceDate',
label: this.$t('transactionlist.balanceDate'),
formatter: (value, key, item) => {
if (value && value.balance >= 0) {
return value.balance
} else {
return '0'
}
return this.$d(new Date(value))
},
},
],
@ -59,7 +61,7 @@ export default {
},
})
.then((result) => {
this.items = result.data.transactionList.transactions.filter((t) => t.type === 'creation')
this.items = result.data.transactionList.transactions
})
.catch((error) => {
this.toastError(error.message)

View File

@ -15,26 +15,16 @@ export const transactionList = gql`
onlyCreations: $onlyCreations
userId: $userId
) {
balanceGDT
count
balance
decayStartBlock
transactions {
id
typeId
amount
balanceDate
creationDate
memo
linkedUser {
firstName
lastName
}
decay {
decay
start
end
duration
}
}
}
}

View File

@ -75,6 +75,7 @@
"transaction": "Transaktion",
"transactionlist": {
"amount": "Betrag",
"balanceDate": "Schöpfungsdatum",
"community": "Gemeinschaft",
"date": "Datum",
"decay": "Vergänglichkeit",

View File

@ -75,6 +75,7 @@
"transaction": "Transaction",
"transactionlist": {
"amount": "Amount",
"balanceDate": "Creation date",
"community": "Community",
"date": "Date",
"decay": "Decay",

View File

@ -112,7 +112,7 @@ export class TransactionResolver {
const transactions: Transaction[] = []
// decay transaction
if (currentPage === 1 && order === Order.DESC) {
if (!onlyCreations && currentPage === 1 && order === Order.DESC) {
transactions.push(
virtualDecayTransaction(lastTransaction.balance, lastTransaction.balanceDate, now, self),
)